Sunday, May 29, 2011

Seamless installation in AIR: Part 1

Today we will learn about seamless AIR application installation.

There are two main ways of letting the user install an AIR application.

The first way - simply provide an .air installation file, which the user can download from your website and launch it, then go through the installation process and finally install the application on their computer.

However, the user might not have AIR runtime installed, which they need to run your application. If it isn't installed, your application won't install properly. This is why there is another way of AIR application installations, which is called seamless installation.

During seamless installation, it is first checked whether the user does or does not have AIR installed. If they don't, it is included in the installation process and installed seamlessly for the user. After that, the .air file is launched, seamlessly again (the user doesn't see it).

Let's see how to do that.

Seamless installation process beings on a web page. The user starts it by pressing a special badge that is displayed on the page. The bage is basically an .swf file, which starts the installation once clicked. We can edit some of its settings, but we'll talk about that later.

You can find the badge files in your samples\badge directory in the AIR SDK. You can find the SDK in the AIK directory of Flash or in the directory of Flex SDK. The main file that we need is called badge.swf. This has all the code that is necessary for seamless installation. We can set needed settings for the file using Flash Vars.

Here's how the default badge looks like, as seen in the sample html page (it is a screenshot below, not a real badge):


We can use Flash Vars to set settings, such as:

  • appname - The name of the AIR application that this badge will install. This name will be displayed if the user doesn't have AIR installed.
  • appurl - The absolute URL address to the .air file.
  • airversion - The version of AIR runtime that this application needs. For example, 2.0
  • imageurl - The URL to the image file that will be displayed in the badge.
  • buttoncolor - The color of the button of the badge. It is set to black by default, but you can change it. The format of the colors is a hex string, for example, FF0000.
  • messagecolor - The color of the text under the button. Set to black by default, format the same as in the previous flash var.

Only two of these are absolutely necessary, and those are - appurl and airversion. All the others have default values.

We will continue next time.

Thank you for reading!

Related:

Seamless installation in AIR: Part 2
Seamless installation in AIR: Part 3

No comments:

Post a Comment