Maverick

Friday, August 17, 2007

Hello World using Apollo/Adobe AIR

Filed under: Latest Trends, RIA — debasishpramanik @ 5:19 pm

Its been days that I was trying to write a simple app using AIR, the buzz word these days, so downloaded the following

  1. Adobe AIR SDK.
  2. Adobe AIR SDK documentation.

Extract these above stuff after downloading. The documentation is quite good for a HTML /Javascript developer like me. Here I write a Hello World html file using AIR framework.

There are three things to be done

  1. Application XML file.
  2. HTML File.
  3. Executing the application.
Application XML File 
  1. Create a XML file named <AppName>-app.xml, here appname can be HelloAIR.
  2. The structure of XML is

   

xml.gif

    The text of rootContent element represents the name of the html file that is associated with the xml.

HTML File

The following the html code

HTML Code

The appLoad is invoked when the page is loaded. As shown above we are including the standard AIRAliases.js file in the HTML file, so AIR runtime will be initialized. If its initialized the Air.Trace statement is used to print on AIR console “Hello Air”. Then XMLHTTP request is made for getting request.txt file and dumping the content of that file onto the AIR console.

Executing the Application

When the AIR sdk is extracted there are two programs that come

  1. ADL: To execute the AIR application
  2. ADT: to package the AIR application

Use the adl command to execute the AIR application.

The ADL command

commandline.gif

When you execute the command with XML as parameter then the following is displayed

execute.gif

As shown above the Hello.AIR is the Air.Trace output and the white console displays thee content of the request.txt file.

3 Comments »

  1. This is helpful info; thanks for posting! Might be nice if the text were real so we could copy/paste, but beggars shan’t be choosers…

    I did noticed that with the release of the latest AIR beta some changes are necessary for this to work. Running it currently produces the error:”This application cannot be run. (error: This application requires a version of the Adobe Integrated Runtime (AIR) which is no longer supported”

    Here’s a version that should work with AIR beta 2 (new xml format and different xmlns url).

    Updated HelloAIR-app.xml
    ————————–

    Hello Air

    Hello Air Test App
    standard
    true
    HelloAir.html

    ————————–

    Also, it’s not totally clear from the text that one should
    - copy the AIR javascript from sdkdirectory\frameworks\AIRAliases.js into the directory with the html and xml
    - create the request.txt file (and put something in it)

    Probably obvious to many, but I thought I’d point it out to the rest. Thanks for putting this together.

    Comment by psthomas — Wednesday, October 17, 2007 @ 9:48 am

  2. Bah — looks like it scrubbed the xml.

    Try http://pastebin.com/f72e4be76

    Comment by psthomas — Wednesday, October 17, 2007 @ 9:53 am

  3. [...] an AIR application can accomplish the same limited functionality with just a bit more code than hello world and that AIR provides much more. But unless Adobe can effectively communicate what the heck AIR is [...]

    Pingback by Mike Linksvayer » RIA marketing follies — Sunday, October 28, 2007 @ 5:57 pm

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.