Chapter 18. Creating a Project for AIR

IN THIS CHAPTER

  • Understanding AIR

  • Convert a project to AIR

  • Completing an AIR project

  • Installing an AIR application

  • Deploying AIR applications from Catalyst

In the spring of 2007, Adobe released a public preview of a new technology code-named Apollo. About a year later in February 2008, Adobe released the final version, which had been renamed Adobe Integrated Runtime (AIR).

AIR, put simply, allows Web designers and developers to leverage their existing skill sets in Flex and Flash, or even HTML, CSS, and JavaScript to develop applications for the desktop.

Prior to AIR's release, desktop application development was done solely by high-end programmers using languages such as Java or C# that required years of training.

Currently, anyone with knowledge of HTML, CSS, and JavaScript or anyone designing or developing in the Flash platform can create an application that users can install on their computers and run without a browser. Better yet, they can now develop applications that will run on any desktop, regardless of the operating system.

Understanding AIR

AIR works by providing a universal runtime. That is, AIR is an application that must be installed by users before they can install your application.

Most of the complexity of building traditional desktop applications had to do with the challenges of interfacing with operating systems and hardware; drastic differences between the ways in which operating systems work further complicated matters.

AIR, however, masks those difficulties. By providing a layer between your application and the operating system and hardware, AIR allows you to develop in much the same way that you develop Web applications. AIR is available free from Adobe's Web site (www.adobe.com). According to the company, it has been downloaded and installed more than 100 million times.

Note

The idea of a universal runtime that provides a layer between the application and the operating system is neither new nor radical. Sun Microsystems, the manufacturer of very high-end computer systems and the company responsible for Java, released the first version of the Java Runtime Environment (JRE) long before Adobe developed the idea for AIR. What makes AIR unique is the ease with which applications can be developed.

AIR contains a Web browser built on the open-source Webkit engine, the same browser engine that runs Apple's Safari browser and Google's Chrome browser. It includes an SQLLite database engine for local data storage, as well as Flash Player and Adobe Reader for playing SWFs and reading PDF files.

AIR applications can either be:

  • Disconnected

  • Completely self-contained and able to run without an Internet connection

  • Connected and thus require an active link to the Internet to access information

  • Semiconnected, going online to collect information when a connection is available but functioning off-line when the computer is disconnected

Flash movies that run in a browser have many of the same capabilities as an AIR application. However, Flash Player, when run in the browser, has a set of key limitations imposed for security purposes. For example, it cannot directly read and write files on the local user's computer, nor does it have hardware access.

Alternately, an AIR application runs at the same level of security as any other installed application, giving it file system and hardware access. AIR 2.0, a beta that was released in the fall of 2009, even includes hardware detection. This feature detects and responds to events such as a USB drive being plugged into the computer.

Converting a Project to AIR

Flex-based AIR projects require slightly different code than Web-based projects. Thus, when you create a project in Flash Builder, you must designate from the beginning whether you will be creating a project for the Web or for AIR. Catalyst does not have a method for designating a project to be deployed for AIR instead of the browser. Therefore, you will not need to do anything special in Catalyst when you design a project that is intended for AIR.

Once you import the project into Flash Builder, you must convert it to an AIR project before commencing any other work. To do so, follow these steps:

  1. Right-click (

    Converting a Project to AIR
  2. Choose Add/Change Project Type

    Converting a Project to AIR
    The Convert to Desktop/Adobe AIR Project menu

    Figure 18.1. The Convert to Desktop/Adobe AIR Project menu

  3. You can have Flash Builder make the necessary change to the root element of your main file from Application to WindowedApplication. Should you choose to not have the conversion done automatically, you need to do so manually before your project can be exported to AIR.

Completing an AIR Project

You can do a significant amount of work within Flash Builder to have your project take advantage of AIR's unique capabilities. However, this additional work may not be necessary, depending on the requirements of the project. It is possible to take a project from Catalyst once the project conversion is complete and simply publish directly to AIR. Flash Builder includes a wizard that steps you through the process of finalizing the project for AIR:

  1. Choose Project

    Completing an AIR Project
  2. Confirm that the correct project and application file are selected.

  3. Enable the option to allow users to view the project's source code.

  4. Select the name of the project's AIR file, which will be the file that the user selects to install the application.

  5. Attach a digital certificate to the project at the wizard's prompt (see Figure 18.3). Certificates assure users that the application was actually delivered from the company they expect, rather than a malicious user merely posing as a company.

    The Export Release Build Wizard's first page

    Figure 18.2. The Export Release Build Wizard's first page

    The Digital Signature page of the Export Release Build Wizard

    Figure 18.3. The Digital Signature page of the Export Release Build Wizard

    For example, anyone could claim that an application was developed by Adobe. However, only Adobe has access to its digital certificate, so only applications signed by Adobe are guaranteed as coming from Adobe.

    If you are developing a project that will only be distributed within a closed network environment, use a certificate issued by your network administrator from the network's own servers. Applications that will be distributed publicly via the Internet can only be trusted if the certificate is issued by a trusted third party, such as VeriSign. VeriSign and its competitors thoroughly investigate individuals and companies before issuing a certificate. The companies offer a variety of certificate products covering a range of prices.

  6. If you do not have a certificate, you can create your own. Ideally, this would only be used for local testing of the project; any application distributed with a self-signed certificate is not likely to be trusted or installed as much as one with a verified certificate. The process of creating a certificate is simple: Click Create and follow the steps outlined in the dialog boxes.

    You can also create an intermediate AIR project that is not signed, but will be later. You will not be able to install this project until it is signed. However, this will allow you to publish the project if you are waiting for approval of a certificate from VeriSign.

  7. Ensure that all required files are going to be included in the AIR package. There may be rare occasions when files within the project are not needed by the AIR application. If this is the case, you can deselect them to minimize the project's file size.

  8. Click Finish (see Figure 18.4). The AIR project is exported and ready to install.

The final page of the Export Release Build Wizard

Figure 18.4. The final page of the Export Release Build Wizard

Note

For details on additional options for AIR applications, including customizing the application icon, controlling its install directory and leveraging unique AIR capabilities like local file system access, see the Adobe AIR Bible.

Installing an AIR Application

Once you export the project, you can install the AIR application to test and ensure that it works properly. AIR applications are installed in much the same way as any other application:

  1. Double-click the project file, either from within the operating system or directly from the Package Explorer in Flash Builder. The installer will launch beginning with a screen that provides details about the project and its certificate.

  2. Click Install (see Figure 18.5). The project will install onto your computer.

    The AIR application installer

    Figure 18.5. The AIR application installer

  3. Launch the application by selecting it in the All Programs directory in the Windows Start menu or from the Applications folder in Finder on a Mac. When launched, the program should behave just as any other locally installed program, including display of an icon on the Windows taskbar (see Figure 18.6).

An AIR application running in Windows

Figure 18.6. An AIR application running in Windows

Deploying to AIR Directly from Catalyst

If no modifications need to be made to the project in Flash Builder, it is possible to deploy an AIR application directly from Catalyst. The Publish as SWF command in the Catalyst File menu includes the option to create an AIR application (see Figure 18.7).

The Publish to SWF dialog box in Catalyst with the option to export to AIR selected

Figure 18.7. The Publish to SWF dialog box in Catalyst with the option to export to AIR selected

Note

See Chapter 17 for more details on the Publish to SWF dialog box and a discussion of its other options.

Selecting the AIR option in the dialog box creates an AIR package along with the Web-specific packages normally produced.

In the folder specified in the dialog box, you will find an AIR folder which in turn includes the AIR file. You can double-click this file to launch the installer (see Figure 18.8), which follows the same steps as an AIR file created in Flash Builder.

Note

Catalyst does not provide a means by which AIR applications can be digitally signed. If you have a digital certificate and want to use it to sign your application, thus avoiding the warning screen at the start of the installation process, you need to import the project into Flash Builder and package it for AIR from there.

Installing an AIR application created directly from Catalyst

Figure 18.8. Installing an AIR application created directly from Catalyst

Summary

In this chapter you explored the Adobe Integrated Runtime (AIR). You learned:

  • The basic concepts of AIR

  • How to convert a project to AIR and publish from Flash Builder

  • How to install and run an AIR application

  • How to publish a project to AIR directly from Catalyst.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.239.118