You are previewing Professional Flash® Mobile Development: Creating Android™ and iPhone® Applications.
O'Reilly logo
Professional Flash® Mobile Development: Creating Android™ and iPhone® Applications

Book Description

Professional Flash Mobile Development: Creating Android and iPhone Applications

Everything Flash developers need to know to create native Android and iPhone apps

This Wrox guide shows Flash developers how to create native applications for Android and iPhone mobile devices using Flash. Packed with practical examples, it shows how to build a variety of apps and integrate them with core mobile services such as Accelerometer, GPS, Photo Library,and more.

  • Offers Flash developers the tools to create apps for the Android and iPhone mobile devices

  • Shows how to design a user interface optimized for Android and iOS and offers plenty of examples for building native Android and iPhone apps with Flash, migrating existing Flash media, testing and debugging applications, and more

  • Helps you understand ways to work with files on Android and iOS

Professional Flash Mobile Development: Creating Android and iPhone Applications answers the demand for Flash-capable Android and iPhone apps.

Table of Contents

  1. Copyright
  2. CREDITS
  3. ABOUT THE AUTHOR
  4. ABOUT THE TECHNICAL EDITOR
  5. ACKNOWLEDGMENTS
  6. INTRODUCTION
    1. WHO THIS BOOK IS FOR
    2. WHAT THIS BOOK COVERS
    3. IOS OR IPHONE?
    4. WHAT YOU NEED TO USE THIS BOOK
    5. CONVENTIONS
    6. SOURCE CODE
    7. ERRATA
    8. P2P.WROX.COM
  7. I. Getting Started
    1. 1. Introducing Flash Development for Mobile Devices
      1. 1.1. EXPANDING TO THE MOBILE WORLD
      2. 1.2. DISCOVERING ADOBE AIR
        1. 1.2.1. Building for Android
        2. 1.2.2. Building for iOS
      3. 1.3. WHAT YOU CAN AND CANNOT DO
        1. 1.3.1. Device Support
        2. 1.3.2. Unsupported AS3 API Objects
      4. 1.4. UNDERSTANDING THE AIR FOR ANDROID SECURITY MODEL
      5. 1.5. GETTING TO KNOW THE ANDROID SDK
      6. 1.6. GETTING TO KNOW THE IOS SDK
      7. 1.7. SUMMARY
    2. 2. Setting Up Your Development Environment
      1. 2.1. PREPARING FOR ANDROID DEVELOPMENT
        1. 2.1.1. Installing the AIR SDK
          1. 2.1.1.1. Flash CS5 Professional
          2. 2.1.1.2. Flex Builder and Flex SDK
        2. 2.1.2. Creating a Code-Signing Certificate
          1. 2.1.2.1. Creating a Certificate in Flash CS5
          2. 2.1.2.2. Creating a Certificate from the Command Line
        3. 2.1.3. Installing the Flash CS5 Extension for AIR 2.5
        4. 2.1.4. Installing the Android SDK
        5. 2.1.5. Adding the Android SDK to Your System Path
          1. 2.1.5.1. Setting the Environment Path in Windows
          2. 2.1.5.2. Setting the System Path in Mac OS X
        6. 2.1.6. Creating an Android Virtual Device
        7. 2.1.7. Installing the AIR Runtime onto Your Device
        8. 2.1.8. Comparing the Development Environment Options
          1. 2.1.8.1. Flash CS5
          2. 2.1.8.2. Flash Builder + Flash CS5
          3. 2.1.8.3. Flash Builder, Flex Builder, or Flex SDK
        9. 2.1.9. Using MXML in Android Apps
      2. 2.2. PREPARING FOR IOS DEVELOPMENT
        1. 2.2.1. Joining the iPhone Developer Program
        2. 2.2.2. Getting an iPhone Developer Certificate
          1. 2.2.2.1. Generating a CSR Using Mac OS X
          2. 2.2.2.2. Generating a CSR Using Windows
          3. 2.2.2.3. Submitting Your CSR
        3. 2.2.3. Retrieving the Developer Certificate
          1. 2.2.3.1. Converting the Certificate on Mac OS X
          2. 2.2.3.2. Converting the Certificate on Windows
        4. 2.2.4. Adding a Device
        5. 2.2.5. Creating an App ID
        6. 2.2.6. Creating a Provisioning Profile
        7. 2.2.7. Installing the Provisioning Profile
          1. 2.2.7.1. Install Using iTunes
          2. 2.2.7.2. Install Using iPhone Configuration Utility
      3. 2.3. SUMMARY
    3. 3. Building and Installing VanillaApp
      1. 3.1. VANILLAAPP FOR ANDROID
        1. 3.1.1. Creating a Project
        2. 3.1.2. Creating a Flash Document for AIR for Android
        3. 3.1.3. Creating an ActionScript Document Class
        4. 3.1.4. Coding the Document Class
          1. 3.1.4.1. Define Import Statements
          2. 3.1.4.2. Define Class Properties
          3. 3.1.4.3. Write the Constructor
          4. 3.1.4.4. Defining Event Handlers
        5. 3.1.5. Adding Icons
        6. 3.1.6. Defining Android Settings
          1. 3.1.6.1. General Settings
          2. 3.1.6.2. Deployment Settings
          3. 3.1.6.3. Icons Settings
          4. 3.1.6.4. Permissions
        7. 3.1.7. Previewing the App inside Flash
        8. 3.1.8. Publishing and Installing the Application
        9. 3.1.9. Running the App on an Android Device
      2. 3.2. VANILLAAPP FOR IOS
        1. 3.2.1. Creating a Project
        2. 3.2.2. Creating an iPhone-Based Flash Document
        3. 3.2.3. Creating an ActionScript Document Class
        4. 3.2.4. Coding the Document Class
          1. 3.2.4.1. Define Class Properties
          2. 3.2.4.2. Write the Constructor
          3. 3.2.4.3. Defining Event Handlers
        5. 3.2.5. Creating a Splash Screen
        6. 3.2.6. Adding Icons
        7. 3.2.7. Defining iPhone Settings
          1. 3.2.7.1. General Settings
          2. 3.2.7.2. Deployment Settings
          3. 3.2.7.3. Icons Settings
        8. 3.2.8. Previewing the App inside Flash
        9. 3.2.9. Publishing the Application
        10. 3.2.10. Installing the App on an iPhone
      3. 3.3. SUMMARY
  8. II. Touch and User Interaction
    1. 4. Rethinking ActionScript Programming
      1. 4.1. CONSERVING MEMORY AND CPU RESOURCES
      2. 4.2. ACTIONSCRIPT PRACTICES
        1. 4.2.1. Reuse Objects
        2. 4.2.2. General Tips for Working with AS3
        3. 4.2.3. Event Handling
      3. 4.3. UI PRACTICES
      4. 4.4. GRAPHICS PRACTICES
        1. 4.4.1. Caching
        2. 4.4.2. Miscellaneous Tips
      5. 4.5. GENERAL APPLICATION PRACTICES
        1. 4.5.1. Frame Rate
        2. 4.5.2. GPU Rendering
        3. 4.5.3. Garbage Collection
        4. 4.5.4. Kitchen Sink Tips
      6. 4.6. SUMMARY
    2. 5. Multitouch API
      1. 5.1. UNDERSTANDING THE MULTITOUCH JARGON
        1. 5.1.1. Mouse Emulation Events
        2. 5.1.2. Touch Events
        3. 5.1.3. Gesture Events
        4. 5.1.4. Listening for Touch Events
        5. 5.1.5. Event Bubbling
      2. 5.2. WORKING WITH TOUCH EVENTS
        1. 5.2.1. Coding the Document Class
        2. 5.2.2. Running the App
      3. 5.3. WORKING WITH THE SWIPE GESTURE
        1. 5.3.1. Setting Up the Timeline
        2. 5.3.2. Adding a Sound Asset
        3. 5.3.3. Coding the Document Class
        4. 5.3.4. Running the App
      4. 5.4. WORKING WITH ROTATE AND ZOOM GESTURES
      5. 5.5. CODING THE DOCUMENT CLASS
        1. 5.5.1. Running the App
      6. 5.6. SUMMARY
    3. 6. Detecting Motion with Accelerometer
      1. 6.1. INTRODUCING ACCELEROMETER AND ACCELEROMETEREVENT
      2. 6.2. LISTENING FOR ACCELEROMETER EVENTS
        1. 6.2.1. Coding the Document Class
        2. 6.2.2. Running the App
      3. 6.3. RESPONDING TO ACCELEROMETER EVENTS
        1. 6.3.1. Creating the Sphere Class
        2. 6.3.2. Coding the Document Class
        3. 6.3.3. Running the App
      4. 6.4. DETECTING SHAKING
        1. 6.4.1. Coding the Document Class
        2. 6.4.2. Running the App
      5. 6.5. SUMMARY
    4. 7. Implementing Auto Orientation
      1. 7.1. ENABLING YOUR APP TO ROTATE
      2. 7.2. STAGEORIENTATIONEVENT
      3. 7.3. TWO ESSENTIALS FOR UI REORIENTATION
      4. 7.4. DETECTING AN ORIENTATION CHANGE
      5. 7.5. CHANGING POSITIONING BASED ON ORIENTATION CHANGES
      6. 7.6. SUMMARY
    5. 8. Geolocation API
      1. 8.1. GETTING GEOLOCATION DATA
      2. 8.2. ENABLING GPS SUPPORT FOR ANDROID
      3. 8.3. CREATING A BASIC GEOLOCATION APPLICATION
        1. 8.3.1. Coding the Document Class
        2. 8.3.2. Testing and Running the App
      4. 8.4. CREATING A COMPASS APP
        1. 8.4.1. Coding the Document Class
        2. 8.4.2. Running the App
      5. 8.5. CREATING A SPEEDOMETER AND ALTIMETER
        1. 8.5.1. Embedding a Font in Your App
        2. 8.5.2. Coding the Document Class
        3. 8.5.3. Configuring Landscape Orientation
          1. 8.5.3.1. Landscape Orientation with Android
          2. 8.5.3.2. Landscape Orientation with iPhone
        4. 8.5.4. Running the App
      6. 8.6. SENDING GEOLOCATION TO A WEB SERVICE
        1. 8.6.1. Coding the Document Class
        2. 8.6.2. Running the App
      7. 8.7. SUMMARY
    6. 9. Service Integration Using URL Protocols
      1. 9.1. ABSTRACTING URL PROTOCOLS
      2. 9.2. MAKING PHONE CALLS FROM YOUR APPLICATION
        1. 9.2.1. Creating PhoneDialer.as
        2. 9.2.2. Using PhoneDialer in an App
          1. 9.2.2.1. Setting Up Your Project
          2. 9.2.2.2. Coding the PhoneServices Class
          3. 9.2.2.3. Android: Adding Permissions
      3. 9.3. SENDING SMS MESSAGES
        1. 9.3.1. Creating SMS.as
        2. 9.3.2. Adding SMS Support to the PhoneServices App
        3. 9.3.3. Running the App
      4. 9.4. SENDING E-MAILS
        1. 9.4.1. Creating Mail.as
        2. 9.4.2. Sending Mail from an App
        3. 9.4.3. Android: Adding Permissions
        4. 9.4.4. Running the App
      5. 9.5. POINTING ON GOOGLE MAPS
        1. 9.5.1. Creating GoogleMaps.as
        2. 9.5.2. Using GoogleMaps in an App
        3. 9.5.3. Android: Setting Permissions
        4. 9.5.4. Running the App
      6. 9.6. SUMMARY
    7. 10. Android Camera, Camera Roll, and Microphone
      1. 10.1. CAMERAUI: LAUNCH AND RETURN
      2. 10.2. CAMERA: CREATING A LIVE VIDEO FEED
      3. 10.3. TAPPING INTO THE CAMERA ROLL
      4. 10.4. CAPTURING SOUNDS WITH THE MICROPHONE
      5. 10.5. SUMMARY
  9. III. Data
    1. 11. File Management
      1. 11.1. UNDERSTANDING THE ANDROID FILE AND DIRECTORY STRUCTURE
      2. 11.2. WORKING WITH DIRECTORIES, FILES, AND FILE STREAMS
        1. 11.2.1. Working with Directories
        2. 11.2.2. File System Operations
          1. 11.2.2.1. Creating a Directory
          2. 11.2.2.2. Creating a Temporary Directory or File
          3. 11.2.2.3. Copying and Moving
            1. 11.2.2.3.1. Synchronous Operations
            2. 11.2.2.3.2. Asynchonous Operations
          4. 11.2.2.4. Deleting Files and Directories
      3. 11.3. READING AND WRITING FILES
        1. 11.3.1. Reading a File
        2. 11.3.2. Writing to a File
        3. 11.3.3. Android Case Study: Jots
          1. 11.3.3.1. Adding Minimal Comps Set
        4. 11.3.4. Coding the Document Class
          1. 11.3.4.1. Filling the Constructor Function
          2. 11.3.4.2. Saving a File
          3. 11.3.4.3. Opening a File
        5. 11.3.5. Running Jots
      4. 11.4. SUMMARY
    2. 12. Local Databases
      1. 12.1. WORKING WITH A SQLITE DATABASE
      2. 12.2. OPEN A DATABASE CONNECTION
        1. 12.2.1. Creating a Synchronous Connection
        2. 12.2.2. Creating an Asynchronous Connection
      3. 12.3. CREATING TABLES
      4. 12.4. MAKING A SQL QUERY
      5. 12.5. INSERTING AND UPDATING RECORDS
      6. 12.6. SUMMARY
  10. IV. Testing and Debugging
    1. 13. Remote Debugging
      1. 13.1. ESTABLISHING A WIFI CONNECTION
      2. 13.2. USING THE AIR DEBUG LAUNCHER
      3. 13.3. ANDROID DEBUGGING
        1. 13.3.1. Remote Debugging inside the Flash IDE
        2. 13.3.2. Remote Debugging from the Command Line
        3. 13.3.3. Debugging with Android SDK's Logcat
      4. 13.4. IOS DEBUGGING
        1. 13.4.1. Remote Debugging inside the Flash IDE
        2. 13.4.2. Viewing GPU Rendering Diagnostics
      5. 13.5. SUMMARY
    2. 14. Submitting Your App to the App Store
      1. 14.1. PREPARING YOUR ANDROID APP
        1. 14.1.1. Getting a Screenshot
      2. 14.2. SUBMITTING YOUR APP TO THE ANDROID MARKET
        1. 14.2.1. Registering Your Developer Profile
        2. 14.2.2. Submitting Your App
      3. 14.3. PREPARING YOUR IOS APP
        1. 14.3.1. Getting a Distribution Certificate
        2. 14.3.2. Creating a Distribution Provisioning Profile
        3. 14.3.3. Publishing a Distribution Release of Your App
      4. 14.4. SUBMITTING YOUR APP TO THE APPLE APP STORE
      5. 14.5. SUMMARY
    3. A. Application Descriptor Settings
      1. A.1. ANDROID APPLICATION DESCRIPTOR SETTINGS
        1. A.1.1. Sample Android Application Descriptor File
        2. A.1.2. Basic Properties
          1. A.1.2.1. <application>
          2. A.1.2.2. <id>
          3. A.1.2.3. <versionNumber>
          4. A.1.2.4. <versionLabel>
          5. A.1.2.5. <filename>
          6. A.1.2.6. <name>
          7. A.1.2.7. <copyright>
          8. A.1.2.8. <description>
          9. A.1.2.9. <initialWindow>
            1. A.1.2.9.1. <aspectRatio>
            2. A.1.2.9.2. <autoOrients>
            3. A.1.2.9.3. <content>
            4. A.1.2.9.4. <fullScreen>
            5. A.1.2.9.5. <renderMode>
          10. A.1.2.10. <supportedProfiles>
          11. A.1.2.11. <icon>
        3. A.1.3. Android Settings
          1. A.1.3.1. Requesting Device Permissions
          2. A.1.3.2. Installing to an External Card
          3. A.1.3.3. Not Displaying an Application on Install
          4. A.1.3.4. Adding Launcher Settings
      2. A.2. IPHONE APPLICATION DESCRIPTOR SETTINGS
        1. A.2.1. Sample iPhone Application Descriptor File
        2. A.2.2. Properties
          1. A.2.2.1. <application>
          2. A.2.2.2. <id>
          3. A.2.2.3. <version>
          4. A.2.2.4. <filename>
          5. A.2.2.5. <name>
          6. A.2.2.6. <copyright>
          7. A.2.2.7. <description>
          8. A.2.2.8. <initialWindow>
            1. A.2.2.8.1. <aspectRatio>
            2. A.2.2.8.2. <autoOrients>
            3. A.2.2.8.3. <content>
            4. A.2.2.8.4. <fullScreen>
            5. A.2.2.8.5. <renderMode>
          9. A.2.2.9. <profiles>
          10. A.2.2.10. Value
          11. A.2.2.11. <icon>
          12. A.2.2.12. <iPhone>
            1. A.2.2.12.1. <InfoAdditions>
    4. B. Compiling Applications from the Command Line
      1. B.1. COMPILING ANDROID APPLICATIONS
      2. B.2. RUNNING THE PACKAGER FOR IPHONE