Adobe Flash CS6 Classroom in a Book: Publishing for a Mobile Device
Note: This excerpt is from the forthcoming book Adobe Flash CS6 Classroom in a Book, ISBN 9780321822512.
Publishing for a Mobile Device
You can also publish Flash content for mobile devices running on Android or on Apple’s iOS, such as the iPhone or iPad. To publish Flash content for a mobile device, you target AIR for Android or AIR for iOS to create an application that viewers download and install on their devices.
Creating an app for mobile devices is a little more complicated than creating an application for the desktop because you have to obtain specific developer certificates for distribution. Moreover, you have to factor in the additional time and effort required for testing and debugging on a separate device. However, Flash Professional CS6 features a mobile device simulator that can help make that testing and debugging easier. The simulator can emulate specific mobile device interactions such as tilting the device (using the accelerometer), touch gestures such as swiping and pinching, or even using the geolocation functions.
Simulating a mobile app
You’ll use the Adobe SimController to simulate mobile device interactions within Flash Professional CS6.
- Open 10Start_mobileapp.fla.
- In the Properties inspector, notice that the Target is set for AIR 3.2 for Android.
- Choose Control > Test Movie > in AIR Debug Launcher (Mobile), which should already be checked.
- In the Simulator panel, click Touch and Gesture to expand that section.
- Check the Touch layer box to enable it.
- Choose Gesture > Swipe.
- Press down on the touch layer over your Flash content, drag to the left, and then let go of your mouse button.
- Swipe left and right.
The project is a simple application with four keyframes that announces an imaginary sports challenge set in our familiar city of Meridien. The project already contains ActionScript that enables the viewer to swipe the Stage left or right to go to the next or previous frames.
Examine the code in the Actions panel. The code was added using the Code Snippets panel, which includes dozens of code snippets for interactivity on mobile devices.
The project publishes to a new window. In addition, the SimController launches, which provides options to interact with the Flash content.
The simulator overlays a transparent gray box over the Flash content to simulate the touch surface of the mobile device.
You can change the opacity of the touch layer by changing the Alpha value, if you wish.
The simulator is now enabled to emulate a swipe interaction. The instructions at the bottom of the panel detail how you can create the interaction with just your mouse cursor.
The yellow dot represents the contact point on the touch layer of the mobile device.
The project recognizes the swipe interaction, and the second keyframe appears.
Flash advances ahead one frame, or moves back one frame.