Use Flash Professional CS51)
Flash Professional CS5 is the earliest development tool that supports AIR Android. It is very convenient to use. You only need to install a plug-in for AIR. The latest version of this plug-in is Beta 2, which is http://labs.adobe.com/javasies/flashpro_extensionforair /.
The downloaded Installation File is suffixed with. zxp, which is a common format for Adobe software extensions. When installing any CS5 software, Extension Manager is installed simultaneously to associate ZXP files. Therefore, on the machine where Flash CS5 is installed, double-click the ZXP file to run it. The installation process is not described in detail.
After installation, restart the Flash software. Click the "file"> "new" command in the navigation menu. In the pop-up file wizard window, switch to the template bar and you will see a new type of AIR for Android, as shown in 1-4. If you select the first template, the program will automatically create a blank program with a standard size of 480 pixels × 800 pixels.
|
Click to view the larger image) Figure 1-4 create a window from the template |
The other three templates are examples. Accelerometer demonstrates how to use the accelerator; Option Menu is an example of Menu creation using the Menu key; swipe Gallery is an image browser that supports Touch gestures. As an example of getting started, these three examples are worth looking.
Compared with AIR desktop development, the Android program has slightly different configurations, mainly because the Android system has its own requirements in terms of program management and permission settings. Click the "file"> "AIR Android settings" command in the navigation menu to bring up the Settings dialog box, as shown in figure 1-5.
The General tab contains all common parameters, which are described as follows:
App name, program name. It will be displayed on the program list page of the system. The naming principle is that both Chinese and English are acceptable, but it should not be too long.
App ID, which is the unique identifier of the program in the system. Generally, the structure of the company name + project name is used, which is similar to the packaging Name Of The ActionScript class, such as com. fluidea. testapp. AIR is added before the ID of all Android programs developed with air.
The ersion and Version parameters are confusing. The former is a number used for program upgrade, and the latter is a character used for displaying version information only. If you want to publish a program to the Google marketplace or other markets, pay special attention to the ersion parameter. Each time an APK file is uploaded to the electronic marketplace, the ersion value of the same program must be higher than that of the previous version, so that the system can detect the release of a new version through the electronic marketplace, then, the system automatically downloads the update or prompts the user to manually update the update. In addition, ersion adopts the format of 000.000.000, and 1.0.0 indicates 1.000.000 rather than 1. The Version parameter is not strictly required and can be set according to development habits, such as V1.0 and Ver1.2.0322.
Click to view the larger image) Figure 1-5 Setting Dialog Box |
Use Flash Professional CS52)
Aspect indicates the orientation of the Program on the device screen. Three options are supported: Portrait, Portrait screen, default value, Landscape, Landscape screen, and Auto. If Auto is selected, the program automatically adapts to the screen orientation of the device. Otherwise, the screen orientation remains unchanged. In any case, the elements on the interface are not automatically positioned in the horizontal and vertical mode of the mobile phone, and everything has to be controlled by code.
Full screen. This option determines whether the program runs in Full screen mode. You can also change the full screen status during running.
Auto orientation. This option determines whether to dispatch the StageOrient-ationEvent event when the screen orientation of the device changes. This option does not affect the orientation of the screen.
Render: rendering mode. Three values are supported: AUTO, CPU, and GPU. The default value is CPU. GPU mode is generally used when bitmap caching is enabled. Hardware acceleration is used to improve program performance.
Include files, all resource files included in the apk package. By default, the main program SWF file and configuration file ***-app are included. xml. All information on the configuration panel is saved in the XML file.
The Deployment tab is the item to be configured when the APK file is published, as shown in figure 1-6.
Figure 1-6 Deployment Tab |
The options are described as follows:
Certificate. Select the path of the signature Certificate in p12 format. The signature certificate is mainly used to ensure program reliability. If not, you can click the Create button on the right to Create a new certificate according to the wizard.
Password: enter the Password you set when creating the certificate.
Android deployment type: Package type of the program. Device release is also the final version for mobile devices. Emulator release is used for testing the Simulator version. Debug enables the version of the debugging module, online debugging can be performed on the device.
After publishing contains two items: Install application on the connected Android device indicates that the generated apk package is automatically installed on the connected device After the apk package is created, it can be a simulator or a mobile phone device connected to a PC through a USB cable. Launch application on the connected Android device indicates that the program runs on the device immediately.
The Icons tab uses Icons of the custom program, which have three sizes respectively. PNG format is recommended.
The Permission tab sets the program's Permission to access device resources, such as whether to allow access to the network or whether to allow operations on files on the SD card.
In general, apart from the differences in program property settings, AIR Android development and desktop development are basically the same.