Starting With Adobe AIR - Flash

If, like me, you always dreamed of migrating your Flash applications to desktop, now there is a solution. In fact, some solutions already existed, such as Zinc. But, it was very difficult to use, since you had to compile your Flash application, and then generate the executable file with Zinc, to run it in the desktop.

Imagine now what it would be like to make this process a lot of times, for each test of your application. It seems hard, right?
Fortunately, Adobe launched its own solution, which allow us, developers, to create Flash, Flex or HTML/JavaScript applications that run in desktop on the AIR plataform.

Recently, Adobe launched the final version of AIR, that can be found on http://www.adobe.com/products/air/.
Let’s start seeing an example of how to create a simple Flash application to run on AIR.

The first step is to install Adobe AIR on your computer, so we can run the applications that we’ll create. You can dowload Adobe AIR on http://get.adobe.com/air/.
Then, we’ll download Adobe AIR update for Flash CS3, that will allow the creation of AIR applications on Flash. http://www.adobe.com/support/flash/downloads.html

After installing AIR and Flash updates, open Flash and create a new Flash File (Adobe AIR).
Drag to the stage a TextArea component and a Button component. Set the instance names as text_txt and button_btn respectively. Then, create a new layer, click on the empty frame and open the Actions panel (Window > Actions).

function showHello(evt:MouseEvent):void
{
texto_txt.text = "Hello, you are on Adobe AIR!";
}

botao_btn.addEventListener(MouseEvent.CLICK, showHello);

Save your file as hello.fla and run the SWF (Control > Test Movie).
Now it’s time to set some settings in our application. Go to Commands > AIR - Application & Installer Settings. Check an example on the image below.

AIR - Application And Installer Settings

File name, is the name of the installation file that Flash will create. Name is the name of the application. Version (optional) specifies the version of application. ID is the unique identifier of the application, you can change it if you want, but use only the characters 0-9, a-z, A-Z, . (dot) and - (dash) with at least 1 character and maximum 212 characters.
Description (optional) is the description of the application. Copyright (optional) are the copyrights :).

Window style defines the window style. There are 3 types:

  • System chrome: uses the default window style of OS.
  • Custom chrome (opaque): uses a default window style, which should be created on the FLA.
  • Custom chrome (transparent): same style of the opaque, but adds transparency to the application, allowing rounded shapes.

Icon allows you to customize the icons used by the application. The Advanced option brings advanced settings, like the size of window, positioning, etc.

After fill the necessary data, we must define a digital signature to the application. Here we have the option to use a business security certificate, or create one. All applications made to Adobe AIR must have be digitally signed. In Digital Signature, click change.

AIR - Digital Signature

The window will open up. In this window, we must have to specify a certificate or create a new one. Click Create… to create a certificate.

AIR - Create Self-Signed Digital Certificate

Another window opens for “our collection”, and this is where we will put the information about our digital certificate. Understand that this certificate will not be recognize as a secure certificate, it serves only so that we can develop and create our applications, without buy a commercial certificate, like www.thawte.com for example.

I will not detail much this screen, to not extend so much, just fill the fields like you want, without forget to define a password.

After fill the fields, choose a path to save the certificate. Remember that you always will use it, each time you create a new AIR application, so save it in a local that you will remember. Then press OK.

Fill the password field in the Digital Signature screen with the password you set earlier. Press OK.

Now in the Applications & Installer Settings screen, click on Publish AIR File to create the .air file.
Go to the folder where you saved the FLA file, and you’ll find a .air file. Run the file. The installation screen of the application will appear.

AIR - Application Install

Due to the fact that we aren’t using a trusted certificate, the Publisher will always appear as UNKNOWN. Click Install. After the installation, the application will run (if you marked the checkbox), and you can click the button to see the text on the box (wow!).

After, check the directory that you choose to install the application, and you’ll see that our executable will be there.

Well, for now is what I have to show you, a simple and small introduction to Adobe AIR on Flash, I hope that has been useful.

See ya!

Portuguese version: http://blogdaweb.com.br/air/conhecendo-o-adobe-air

0 Responses to “Starting With Adobe AIR - Flash”


  1. No Comments

Leave a Reply