とりあえずHello world

アプリ作成に必要なリソースは最低限2つ。

  • アプリケーション記述ファイル(application descriptor)
  • ルートアプリケーションファイル(html)

descriptorのほうはxmlファイルで、アプリケーションとして必要な情報が書かれている。SDKのtemplateディレクトリの下にテンプレートがあるが、必要最低限のものを書くとこんな感じ。

<?xml version="1.0" encoding="UTF-8"?>
	<application xmlns="http://ns.adobe.com/air/application/1.0">
		<id>jp.wakufactory.test.hw</id>
		<name>AIRHelloWorld</name>
		<version>1.0</version>
		<filename>hw</filename>
		<description>Simple Hello World Example using HTML</description>
		<copyright>wakufactory</copyright>
		<initialWindow>
		        <title>AIRHelloWorld Installer</title>
			<content>hw.html</content>
			<systemChrome>standard</systemChrome>
			<transparent>false</transparent>
			<visible>true</visible>
			<width>500</width>
			<height>500</height>
		</initialWindow>
</application>

ルートアプリケーションは、メインとなるhtml。hw.htmlという名前で作成。
hello worldはこんなの。javascriptは何もない。

<html>
<body>
 <h1>Hello World</h1>
</body>
</html>

このhw.xmlとhw.htmlの2つのファイルを作成し、実行してみる。
実行は、SDKのadlコマンドを使う。コマンドラインから、

>adl hw.xml

のようにすると、ウインドウが開きHello Worldが表示される。
これでAIRのランタイムを使ってhtmlが表示されたことになる。もちろん、htmlにjavascriptを組み込んで動かすこともできる。