Flash iOS Apps Cookbook

Book description

Over 100 practical recipes for developing iOS apps with Flash Professional and Adobe AIR.

  • Build your own apps, port existing projects, and learn the best practices for targeting iOS devices using Flash.
  • How to compile a native iOS app directly from Flash and deploy it to the iPhone, iPad or iPod touch.
  • Full of practical recipes and step-by-step instructions for developing iOS apps with Flash Professional.

In Detail

The latest version of Flash Professional can directly target iOS, allowing Flash developers to write applications that will run natively on Apple's iPhone, iPad, and iPod touch. What's more, with Apple loosening its restrictions on third-party technologies, apps written in Flash can now be sold and distributed within the App Store.

Flash iOS Apps Cookbook provides the recipes required to build native iOS apps using your existing knowledge of the Flash platform. Whether you want to create something new or simply convert an existing Flash project, the relevant steps and techniques will be covered, helping you achieve your goal.

Learn how to configure and use Flash Professional for iOS development by writing and deploying a simple app to a device. Implement many iOS-specific features such a multi-touch, the virtual keyboard, camera support, screen orientation and the Retina display. Overcome the limitations of mobile development by mastering hardware acceleration and optimization. Whether you’re an enthusiast or professional developer, the Flash iOS Apps Cookbook is your toolkit to creating high-quality content for iPhone, iPad and iPod touch.

Table of contents

  1. Flash iOS Apps Cookbook
    1. Table of Contents
    2. Flash iOS Apps Cookbook
    3. Credits
    4. About the Author
    5. Acknowledgement
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Getting Started with iOS App Development
      1. Introduction
      2. Joining the iOS Developer Program
        1. Getting ready
        2. How to do it...
          1. Register as an Apple developer
          2. Select your program
          3. Complete your purchase
        3. How it works...
        4. There's more...
          1. Working with multiple team members
          2. iOS SDK, tools, and documentation
      3. Accessing the iOS Provisioning Portal
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Resources
          2. Adding team members
          3. Distribution
          4. Technical support
      4. Generating a Certificate Signing Request using Windows
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Generating a Certificate Signing Request using Mac OS X
        1. How to do it...
        2. How it works...
        3. See also
      6. Obtaining your development certificate
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Approving Certificate Signing Requests
          2. Team roles
          3. Distribution certificates
      7. Creating a P12 certificate using Windows
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Certificate expiration
      8. Creating a P12 certificate using Mac OS X
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Certificate expiration
      9. Registering a device
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Adding devices in a team environment
          2. Editing device names
          3. Device limit
          4. UDID Sender
      10. Creating an App ID
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Bundle Identifier naming convention
          2. App distribution
          3. Editing App IDs
      11. Creating a development provisioning profile
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Profile expiration
          2. Editing provisioning profiles
          3. Additional provisioning profile types
          4. Working with multiple team members
      12. Installing a provisioning profile on your device
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Removing provisioning profiles
          2. iPhone Configuration Utility
    10. 2. Building iOS Apps Using Flash
      1. Introduction
      2. Installing the AIR SDK
        1. Getting ready
        2. How to do it...
          1. Updating Flash Professional
          2. Overlaying the AIR SDK
        3. How it works...
      3. Creating an AIR for iOS document
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Stage dimensions
          2. Frame rate
        5. See also
      4. Adding content to the stage
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. AIR for iOS general settings
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Adding the status bar
          2. Including files
        5. See also
      6. AIR for iOS deployment settings
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Specifying an App ID
          2. Deployment types
        5. See also
      7. Compiling from Flash Professional
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. The LLVM compiler infrastructure
      8. Installing your app with iTunes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Updating version numbers
          2. iPhone Configuration Utility
          3. TestFlight
    11. 3. Writing your First App
      1. Introduction
      2. Creating a basic document class
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Naming the document class
          2. Using packages
          3. Editing with Flash Builder
          4. Creating other ActionScript 3.0 classes
        5. See also
      3. Preventing screen idle
        1. Getting ready
        2. How to do it...
        3. How it works...
      4. Handling multitasking
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Background processing
          2. App closing
      5. Exiting gracefully from an app
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. The app switcher
          2. Cleaning up
          3. Script execution time
      6. Linking classes to movie-clip symbols
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Extending sprite
      7. Using an update loop
        1. How to do it...
        2. How it works...
      8. Including an application launch image
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Landscape orientation
          2. Supporting the Retina display
          3. iPad launch images
          4. Universal apps
          5. Using the status bar
          6. Bundling other files
        4. See also
      9. Including icons
        1. How to do it...
        2. How it works...
      10. Editing the application descriptor file
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Status bar style
        5. See also
      11. Remote debugging
        1. Getting ready
        2. How to do it...
          1. Creating a debug build
          2. Connecting to the Remote Debugger
        3. How it works...
        4. There's more...
          1. Remote connection attempts
    12. 4. Porting Flash Projects to iOS
      1. Introduction
      2. Handling user interaction
        1. Getting ready
        2. How to do it...
          1. Creating the button movie clip
          2. Linking a class to the button
        3. How it works...
        4. There's more...
          1. Re-using the button class
          2. Handling keyboard controls
        5. See also
      3. Saving application state
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Flattening the display list
        1. Getting ready
        2. How to do it...
        3. How it works...
      5. Converting vectors to bitmaps
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Export as Bitmap
          2. Convert to Bitmap
          3. Working with timeline animation
          4. Targeting multiple screen sizes
          5. Pre-rendering filters and blends
        5. See also
      6. Resizing bitmaps
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Targeting multiple screen sizes
          2. Optimizing vector shapes
          3. Stage quality
        5. See also
      7. Masking content
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      8. Working with external SWFs
        1. Getting ready
        2. How to do it...
          1. Publishing a SWC
          2. Statically linking the SWC
        3. How it works...
        4. There's more...
        5. See also
    13. 5. Multi-touch and Gesture Support
      1. Introduction
      2. Setting the touch point input mode
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Available touch events
          2. Determining the number of supported touch points
          3. Touch point hit targets
          4. Mouse events
          5. Testing in ADL
        5. See also
      3. Detecting multiple touch points
        1. Getting ready
        2. How to do it...
          1. Updating the Bubble class
          2. Responding to multiple touch events
        3. How it works...
          1. Handling roll out
        4. There's more...
          1. Primary touch point
          2. Touch point ID
          3. Local touch coordinates
          4. Global touch coordinates
        5. See also
      4. Dragging multiple display objects
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. startTouchDrag() parameters
        5. See also
      5. Tracking movement
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Setting the gesture input mode
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Available gesture events and types
          2. Determining the supported gestures
          3. Mouse events
          4. Testing in ADL
        5. See also
      7. Handling a swipe gesture
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Swiping vertically
        5. See also
      8. Panning an object
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Gesture phases
          2. Single finger panning
        5. See also
      9. Rotating an object
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      10. Zooming an object
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    14. 6. Graphics and Hardware Acceleration
      1. Introduction
      2. Comparing vector and bitmap graphics
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Stage quality
        5. See also
      3. Understanding GPU-Blend mode
        1. Getting ready
        2. How to do it...
        3. How it works...
          1. The rendering process
          2. CPU mode and GPU-Blend mode
          3. Redrawing dirty regions
        4. There's more...
          1. Auto rendering
        5. See also
      4. Understanding GPU-Vector mode
        1. Getting ready
        2. How to do it...
        3. How it works...
          1. GPU-Vector mode
        4. There's more...
          1. Rendering vectors using GPU-Vector mode
          2. Using GPU-Vector mode with Flash Professional CS5
          3. Stage 3D
        5. See also
      5. Using Cache as Bitmap
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Other transformation changes
          2. Caching display objects that contain children
          3. Taking advantage of GPU Blend
          4. Bitmaps and GPU Vector
          5. Using vectors ahead of bitmaps
        5. See also
      6. Using Cache as Bitmap Matrix
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Selecting a matrix transformation
          2. Changing the Matrix object
          3. Reusing the Matrix object
          4. 3D properties
          5. Working with GPU Blend
        5. See also
      7. Accessing bitmaps with ActionScript
        1. Getting ready
        2. How to do it...
          1. Exporting the bitmap
          2. Displaying the bitmap using ActionScript
        3. How it works...
        4. There's more...
          1. Managing image sizes
          2. Size restrictions
          3. Storing bitmap data on the GPU
        5. See also
      8. Loading bitmaps at runtime
        1. Getting ready
        2. How to do it...
          1. Bundling the bitmap
          2. Loading the bitmap at runtime
        3. How it works...
        4. There's more...
          1. Handling load errors
          2. Accessing the bitmap's data
          3. Disposing of bitmap data
        5. See also
      9. Working with sprite sheets
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Creating sprite sheets
          2. Comparing performance and memory consumption
        5. See also
      10. Performing bitmap animation with ActionScript
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Animation sequences
          2. Loading resources at runtime
          3. Stage 3D
        5. See also
    15. 7. Working with Text and the Virtual Keyboard
      1. Introduction
      2. Using device fonts within text fields
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Device fonts on iOS
          2. Enumerating the available device fonts
          3. Pixel density
          4. TLF text
        5. See also
      3. Using embedded fonts within text fields
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Size considerations
        5. See also
      4. Providing text entry
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Keyboard types
          2. Launching the virtual keyboard programmatically
        5. See also
      5. Capturing text input
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Listening for focus
        5. See also
      6. Configurable panning with virtual keyboard activation
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Related object
      7. Updating dynamic text fields
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Device fonts
          2. Appending text
          3. Replacing text fields with bitmaps
          4. Cache as Bitmap
        5. See also
      8. Using native iOS text controls
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Virtual keyboard types
          2. Return key label types
          3. Enumerating device fonts
          4. Events
          5. Auto-correction and auto-capitalization
        5. See also
    16. 8. Screen Resolution and Orientation Changes
      1. Introduction
      2. Targeting a device
        1. Getting ready
        2. How to do it...
          1. Setting the target devices
          2. Detecting the current device
        3. How it works...
        4. There's more...
          1. Application launch image
          2. Including icons
          3. Landscape aspect ratio
        5. See also
      3. Targeting the Retina display
        1. Getting ready
        2. How to do it...
          1. Setting Retina display support
          2. Detecting a Retina display device
        3. How it works...
        4. There's more...
          1. Retina home screen icon
          2. Retina application launch image
          3. Vector-only apps
          4. iPad display
        5. See also
      4. Supporting multiple resolutions
        1. Getting ready
        2. How to do it...
          1. Setting supported devices and resolutions
          2. Displaying the correct bitmap
        3. How it works...
        4. There's more...
          1. Default stage size
          2. Model-View-Controller architecture
          3. Dynamic sizing and layout
          4. Supporting iPad separately
        5. See also
      5. Setting the default aspect ratio
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Auto aspect ratio
        5. See also
      6. Enabling auto-orientation
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Checking for orientation support
          2. Programmatically setting auto-orientation
          3. Stage scale mode
          4. Stage alignment
        5. See also
      7. Listening for orientation changes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Determining device orientation
        5. See also
      8. Responding to orientation changes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. The stage color
          2. Stage orientation
          3. Preventing auto-orientation
        5. See also
    17. 9. Geolocation and Accelerometer APIs
      1. Introduction
      2. Determining your current location
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Accuracy
          2. Altitude support
          3. Mapping your location
          4. Calculating distance between geolocations
          5. Geocoding
          6. Gyroscope support
        5. See also
      3. Determining your speed and heading
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Determining support
          2. Simulating the GPS receiver
          3. Preventing screen idle
        5. See also
      4. Checking for geolocation access
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Responding to accelerometer changes
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Orientation and the accelerometer axes
          2. Determining device orientation
          3. Applying a low-pass filter
          4. Applying a high-pass filter
          5. The "muted" property
        5. See also
      6. Detecting a shake
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Checking multiple axes
          2. Smoothing accelerometer data
        5. See also
    18. 10. Camera and Microphone Support
      1. Introduction
      2. Saving to the camera roll
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Handling a failed save
          2. Saving specific display objects
          3. Video and the camera roll
        5. See also
      3. Reading from the camera roll
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Parsing Exif data
        5. See also
      4. Capturing with the default camera app
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Handling errors
          2. Displaying the captured image
          3. Saving the captured image to the camera roll
          4. Capturing video
          5. Reading the captured data
        5. See also
      5. Working with the built-in cameras
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Portrait mode
          2. Selecting a camera
          3. Grabbing a bitmap image
          4. Live streaming
          5. Using the stage
        5. See also
      6. Recording microphone audio
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Microphone activity
          2. Live streaming
        5. See also
      7. Playing recorded audio
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Working with lower sample rates
          2. Saving captured data
          3. Exporting as WAV or MP3
        5. See also
    19. 11. Rendering Web Pages
      1. Introduction
      2. Opening a web page within Safari
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      3. Rendering a web page within an app
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Page load events
          2. Multiple instances
          3. Checking for support
          4. Retina web pages within a standard screen resolution
          5. Including banner ads
          6. OAuth support
        5. See also
      4. Navigating the browsing history
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Obtaining the current location
          2. Stopping and reloading pages
          3. Detecting when the URL is about to change
        5. See also
      5. Rendering a local web page
        1. Getting ready
        2. How to do it...
          1. Bundling the HTML
          2. Loading the bundled HTML
        3. How it works...
        4. There's more...
          1. Bi-directional ActionScript/JavaScript communication
        5. See also
      6. Dynamically generating a local web page
        1. Getting ready
        2. How to do it...
          1. Linking to the as3corelib API
          2. Generating the HTML
        3. How it works...
        4. There's more...
          1. Cleaning-up
          2. Using loadString()
        5. See also
      7. Capturing a snapshot of a web page
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Overlaying display objects
        5. See also
    20. 12. Working with Video and Audio
      1. Introduction
      2. Playing local FLV video
        1. Getting ready
        2. How to do it...
          1. Bundling the FLV video
          2. Playing the FLV video
        3. How it works...
        4. There's more...
          1. Metadata and cue point events
          2. Playing remote FLV video
          3. Screen lock
          4. Maximizing playback performance
          5. Bundling multiple videos
        5. See also
      3. Playing local H.264 video
        1. Getting ready
        2. How to do it...
          1. Bundling the H.264 video
          2. Playing the H.264 video
        3. How it works...
        4. There's more...
          1. Metadata and cue point events
          2. Playing video captured by the default camera
          3. Determining the video's size
          4. Playing remote H.264 video
          5. Encoding H.264 video
          6. Bundling multiple videos
        5. See also
      4. Controlling video
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. NetStream status
          2. Closing the video stream
      5. Embedding audio
        1. How to do it...
        2. How it works...
        3. See also
      6. Playing embedded audio
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Playback position
          2. Looping
        5. See also
      7. Streaming audio
        1. Getting ready
        2. How to do it...
          1. Bundling the MP3 file
          2. Playing the MP3 file
        3. How it works...
        4. There's more...
          1. Increasing the buffer time
          2. Monitoring load progress
          3. Sound length
          4. Sound metadata
          5. Working with raw PCM sound data
          6. Playing audio in the background
        5. See also
      8. Controlling audio playback
        1. Getting ready
        2. How to do it...
          1. Bundling the MP3 file
          2. Controlling playback
        3. How it works...
        4. There's more...
          1. Volume and panning
          2. Global sound
        5. See also
    21. 13. Connectivity, Persistence, and URI Schemes
      1. Introduction
      2. Monitoring Internet connectivity
        1. Getting ready
        2. How to do it...
          1. Linking the SWC file
          2. Checking connectivity
        3. How it works...
        4. There's more...
          1. Monitoring sockets
          2. Polling interval
        5. See also
      3. Specifying a persistent Wi-Fi connection
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Referencing an app's common directories
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Creating directories
        5. See also
      5. Writing files
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Working with data formats
          2. Writing synchronously
          3. Monitoring progress
          4. Persistence
        5. See also
      6. Reading files
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Working with data formats
          2. Reading synchronously
          3. Monitoring progress
          4. Deleting files
          5. Other file modes
        5. See also
      7. Launching system applications
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Dialing a phone number
          2. Sending SMS messages
          3. Playing a YouTube video
          4. URI schemes within HTML
        5. See also
      8. Launching the App Store
        1. Getting ready
        2. How to do it...
          1. Obtaining the app's URL
          2. Linking to the app from ActionScript
        3. How it works...
        4. See also
      9. Launching the Maps application
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Generating directions
          2. Mapping your current location
        5. See also
      10. Declaring device capabilities
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Dropped support for ARMv6 devices
        5. See also
    22. Index

Product information

  • Title: Flash iOS Apps Cookbook
  • Author(s): Christopher Caleb
  • Release date: February 2012
  • Publisher(s): Packt Publishing
  • ISBN: 9781849691383