Create your first AIR app in 10 steps

AIR, Web development Sam | 11 Sep. 2009

Hi. I am Sam. Production Director at These Days. I’m no developer, I’m no Flash wizard, I’m no jQuery guru. But I like to play around with ‘techy stuff’. And since this labs blog is about sharing said ‘techy stuff’, well… don’t mind if I do :-) I like to believe that there are others like me that don’t think they are gods like half of my department and even find my writings of value :)

So here I was, searching the web to see how I could make my first AIR app and whaddaya know … it wasn’t all that difficult.

I used:

  • Windows 7
  • Editplus (notepad alike)
  • Windows command prompt
  • AIR sdk

So if you are on a mac .. sorry, can’t help ya m8 :)

Step 0: Realizing that I can’t do any Flash shizzle so if I want to make an AIR app I’ll need to use HTML & Javascript

Step 1: Download AIR (http://get.adobe.com/air/)

Step 2: Download the AIR SDK (http://www.adobe.com/products/air/tools/sdk/)

(OPTIONAL) Step 3: Change your environment path (on Windows 7 you can do this by going into Computer properties > Advanced system settings > Environment variables > add ;c:\air\bin\; to System variable “Path”) > Is just to make everything more easy.

Step 4: Create folder MyFirstAIRapp on your desktop

Step 5: Create folders MyFirstAIRapp\source & MyFirstAIRapp\build

Step 6: Create \source\application.xml

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://ns.adobe.com/air/application/1.0">
   <id>examples.sp.helloworld</id>
   <filename>helloWorld</filename>
   <version>1</version>
   <name>Hello World</name>
   <description>My first AIR app - Hello World</description>
   <initialWindow>
       <content>index.html</content>
       <visible>true</visible>
	   <width>300</width>
	   <height>200</height>
   </initialWindow>
</application>

Step 7: Create \source\index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title> My first AIR app - Hello world </title>

      <meta name="author" content="Sam Serrien" />
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   </head>

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

Step 8: Test it > Open the Command prompt and go into your source folder to build

c:\MyFirstAIRapp\source\> adl application.xml

…and see your app at work

Step 9: Create a certificate (unsigned but who cares)

c:\MyFirstAIRapp\source\> adt -certificate -cn SelfSigned 1024-RSA
      ../cert.pfx 1234

1234 is your password, you’ll need this to compile the app

Step 10: Compile your app and call yourself an AIR application developer :p

c:\MyFirstAIRapp\source\> adt -package -storetype pkcs12 -keystore ../cert.pfx
      ../build/HelloWorld.air application.xml .

Use your password (in my case 1234) et voila.

myfirstairapp

Offcourse I realise that this is doing it ‘the hard way’. Tools do exists:

Happy scripting :)

Leave a reply

Switch to our mobile site