Friday, March 4, 2011

Introduction to Adobe AIR: Part 3

Today we will learn about descriptors.

Every AIR project has to have a descriptor. If you are using Adobe Flash or Adobe Flex Builder - the XML file is generated automatically. If you are using Flex SDK or AIR SDK - you'll have to create it manually.

So what is this descriptor? Basically, it is an XML file that contains information about your application.

Let's create one. Start by creating the main application nodes:

<?xml version="1.0" encoding="utf-8" ?> 
<application xmlns="http://ns.adobe.com/air/application/2.0">
</application>

All the properties of our project will be put inside.

<?xml version="1.0" encoding="utf-8" ?> 
<application xmlns="http://ns.adobe.com/air/application/2.0">
<id>testfile</id> 
<version>1.0</version> 
<filename>Test file!</filename> 
<initialWindow>
<content>myfile.html</content>
<visible>true</visible>
</initialWindow>
</application>

The ID property is not seen to the user and is basically an unique identifier of the application. Filename property is used to define the name of your AIR file. Version is a numeric value that is useful when you're updating your software regularly. The initialWindow node contains 2 properties in this example - content and visible. The content is used to direct AIR to the file that needs to be loaded. In this example its a html file, but, for example, if you create AIR with Flash, it will automatically put the file with .swf extension as the value. So basically, it's the main container that loads stuff. And visible property is to make the window visible/invisible.

Those are the basic properties needed in the XML file, but you can add more. Use this page as a reference.

When creating an AIR project with Flash, you'll be asked to fill out a form, which, in fact, will be used to create that XML file.



AIR can combine many files. If you are using AIR SDK to create your application, you can create multiple folders and file in your main project folder, and when it is compiled - AIR will have them all inside.

And that's it about descriptors! Be sure to check out the next tutorials as well!

Thanks for reading!

Related:

Introduction to Adobe AIR: Part 1
Introduction to Adobe AIR: Part 2
Introduction to Adobe AIR: Part 4
Introduction to Adobe AIR: Part 5
Introduction to Adobe AIR: Part 6
Introduction to Adobe AIR: Part 7
Introduction to Adobe AIR: Part 8
Introduction to Adobe AIR: Part 9

1 comment:

e signatures said...

As you wrote that Every AIR project has to have a descriptor.I never knew that the XML file is generated automatically when I work on Adobe flash.You blog really added to my knowledge.Thanks

Post a Comment