Flash Development for Android Cookbook

Over 90 recipes to build exciting Android applications with Flash, Flex, and AIR

Flash Development for Android Cookbook

Cookbook
Joseph Labrecque

Over 90 recipes to build exciting Android applications with Flash, Flex, and AIR
$29.99
$49.99
RRP $29.99
RRP $49.99
eBook
Print + eBook
$12.99 p/month

Get Access

Get Unlimited Access to every Packt eBook and Video course

Enjoy full and instant access to over 3000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

+ Collection
Free Sample

Book Details

ISBN 139781849691420
Paperback372 pages

About This Book

  • The quickest way to solve your problems with building Flash applications for Android
  • Contains a variety of recipes to demonstrate mobile Android concepts and provide a solid foundation for your ideas to grow
  • Learn from a practical set of examples how to take advantage of multitouch, geolocation, the accelerometer, and more
  • Optimize and configure your application for worldwide distribution through the Android Market
  • Part of Packt's Cookbook series: Each recipe is a carefully organized sequence of instructions to complete the task as efficiently as possible

Who This Book Is For

This book contains recipes covering a variety of topics from the very simple to those that are more advanced. If you are a seasoned Flash developer, this book will get you quickly up to speed with what is possible with Android. For those who are new to Flash, welcome to the world of visually rich, rapid application development for mobile Android devices! If you have any interest in Flash development for Android, this book is for you.

Table of Contents

Chapter 1: Getting Ready to Work with Android: Development Environment and Project Setup
Introduction
Using Flash Professional CS5.5 to develop Android applications
Targeting AIR for Android with Flash Professional CS5.5
Using Flash Builder 4.5 to develop Android applications
Enabling Flash Builder 4 or Flex Builder to access Flex Mobile SDKs
Using Flash Builder 4 and below to develop Android applications
Enabling Powerflasher FDT 4.1 to access Flex Mobile SDKs
Using Powerflasher FDT 4.1 and below to develop Android applications
Converting a standard Flex project to a Flex Mobile project
Configuring the AIR SDK to package AIR for Android applications on Windows
Configuring the AIR SDK to package AIR for Android applications on Linux or Mac OS
Chapter 2: Interaction Experience: Multitouch, Gestures, and Other Input
Introduction
Detecting supported device input types
Detecting whether or not a device supports multitouch
Verifying specific gesture support for common interactions
Using gestures to zoom a display object
Using gestures to pan a display object
Using gestures to swipe a display object
Using gestures to rotate a display object
Accessing raw touchpoint data
Creating a custom gesture based upon touchPoint data
Emulating the Android long-press interaction
Invoking the virtual keyboard programmatically
Responding to Android soft-key interactions
Responding to trackball and D-Pad events
Chapter 3: Movement through Space: Accelerometer and Geolocation Sensors
Introduction
Detecting whether or not an Android device supports the accelerometer
Detecting Android device movement in 3D space
Adjusting the accelerometer sensor update interval
Updating display object position through accelerometer events
Switching between portrait and landscape based upon device tilt
Detecting whether or not a device supports a geolocation sensor
How it works...
There's more...
See also…
Retrieving device geolocation sensor data
Adjusting the geolocation sensor update interval
Retrieving map data through geolocation coordinates
Chapter 4: Visual and Audio Input: Camera and Microphone Access
Introduction
Detecting camera and microphone support
Using the traditional camera API to save a captured image
Using the Mobile CameraUI API to save a captured photograph
Using the Mobile CameraUI API to save a captured video
Using the device microphone to monitor audio sample data
Recording Microphone Audio Sample Data
Chapter 5: Rich Media Presentation: Working with Images, Video, and Audio
Introduction
Loading photographs from the device cameraRoll
How it works…
There's more…
Applying Pixel Bender Shader effects to loaded images
Playing video files from the local filesystem or over HTTP
Playing remote video streams over RTMP
Playing audio files from the local filesystem or over HTTP
Generating an audio spectrum visualizer
Generating audio tones for your application
Chapter 6: Structural Adaptation: Handling Device Layout and Scaling
Introduction
Detecting useable screen bounds and resolution
Detecting screen orientation changes
Scaling visual elements across devices at runtime
Scaling visual elements based on stage resize in Flash Professional CS5.5
Employing the Project panel in Flash Professional CS5.5
Freezing a Flex application to landscape or portrait mode
Defining a blank Flex mobile application
Defining a Flex mobile view-based application
Defining a Flex mobile tabbed application with multiple sections
Using a splash screen within a Flex mobile application
Configuring the ActionBar within a Flex mobile project for use with ViewNavigator
Hiding the ActionBar control in a single view for a Flex mobile project
Chapter 7: Native Interaction: StageWebView and URI Handlers
Introduction
Opening a website in the default Android browser
Rendering a website within an application
Managing the StageWebView history
Using StageWebView to load ads using ActionScript
Using StageWebView to load ads within a Flex mobile project
Making a phone call from an application
Sending a text message from an application
Invoking Google maps from an application
Invoking the Android Market using application URIs
Sending e-mail from an application
Chapter 8: Abundant Access: File System and Local Database
Introduction
Opening a local file from device storage
Saving a file to device storage
Saving data across sessions through local shared object
Storing application state automatically by using Flex
Creating a local SQLite database
Providing a default application database
Automating database tasks with FlexORM
Chapter 9: Manifest Assurance: Security and Android Permissions
Introduction
Setting application permissions with the Android Manifest file
Preventing the device screen from dimming
Establishing Android custom URI schemes
Anticipating Android Compatibility Filtering
Instructing an application to be installed to Device SDCard
Encrypting a local SQLite database
Chapter 10: Avoiding Problems: Debugging and Resource Considerations
Introduction
Debugging an application with Flash Professional
Debugging an application with Flash Builder
Rendering application elements using the device GPU
Automating application shutdown upon device interruption events
Exiting your application with the device back button
Monitoring memory usage and frame rate in an application
Chapter 11: Final Considerations: Application Compilation and Distribution
Introduction
Generating a code-signing certificate using Flash Professional
Generating a code-signing certificate using Flash Builder
Generating a code-signing certificate using FDT
Generating a code-signing certificate using the AIR Developer Tool
Preparing icon files for distribution
Compiling an application using Flash Professional
Compiling an application using Flash Builder
Compiling an application when using FDT
Compiling an application using the AIR Developer Tool
Submitting an application to the Android Market

What You Will Learn

  • Configure Flash Professional, Flash Builder, or FDT to develop Android applications cross-platform regardless of operating system
  • Convert Flex and ActionScript projects to true mobile experiences
  • Work with multitouch and gestures for a truly innovative user experience
  • Use the geolocation and accelerometer sensors to respond to location and movement
  • Make use of the built-in microphone and camera hardware for user generated content
  • Stream audio and video to an application using a variety of protocols
  • Use advanced image display and modifications using custom shaders
  • Effectively scale and position the interface elements across devices
  • Employ a variety of URI handlers to invoke native SMS, telephone, e-mail, maps, and more
  • Work with the Android file system and manage application databases easily
  • Compile and submit your application or game to the ever growing, worldwide Android Market

In Detail

Flash has now arrived to Android — the fastest growing smartphone platform. This offers massive opportunities for Flash developers who want to get into mobile development. At the same time, working on smartphones will introduce new challenges and issues that Flash developers may not be familiar with.

The Flash Development for Android Cookbook enables Flash developers to branch out into Android mobile applications through a set of essential, easily demonstrable recipes. It takes you through the entire development workflow: from setting up a local development environment, to developing and testing your application, to compiling for distribution to the ever-growing Android Market.

The Flash Development for Android Cookbook starts off with recipes that cover development environment configuration as well as mobile project creation and conversion. It then moves on to exciting topics such as the use of touch and gestures, responding to device movement in 3D space, working with multimedia, and handling application layout. Essential tasks such as tapping into native processes and manipulating the file system are also covered. We then move on to some cool advanced stuff such as Android-specific device permissions, application debugging and optimization techniques, and the packaging and distribution options available on the mobile Android platform.

In a nutshell, this cookbook enables you to get quickly up to speed with mobile Android development using the Flash Platform in ways that are meaningful and immediately applicable to the rapidly growing area of mobile application development.

Authors

Table of Contents

Chapter 1: Getting Ready to Work with Android: Development Environment and Project Setup
Introduction
Using Flash Professional CS5.5 to develop Android applications
Targeting AIR for Android with Flash Professional CS5.5
Using Flash Builder 4.5 to develop Android applications
Enabling Flash Builder 4 or Flex Builder to access Flex Mobile SDKs
Using Flash Builder 4 and below to develop Android applications
Enabling Powerflasher FDT 4.1 to access Flex Mobile SDKs
Using Powerflasher FDT 4.1 and below to develop Android applications
Converting a standard Flex project to a Flex Mobile project
Configuring the AIR SDK to package AIR for Android applications on Windows
Configuring the AIR SDK to package AIR for Android applications on Linux or Mac OS
Chapter 2: Interaction Experience: Multitouch, Gestures, and Other Input
Introduction
Detecting supported device input types
Detecting whether or not a device supports multitouch
Verifying specific gesture support for common interactions
Using gestures to zoom a display object
Using gestures to pan a display object
Using gestures to swipe a display object
Using gestures to rotate a display object
Accessing raw touchpoint data
Creating a custom gesture based upon touchPoint data
Emulating the Android long-press interaction
Invoking the virtual keyboard programmatically
Responding to Android soft-key interactions
Responding to trackball and D-Pad events
Chapter 3: Movement through Space: Accelerometer and Geolocation Sensors
Introduction
Detecting whether or not an Android device supports the accelerometer
Detecting Android device movement in 3D space
Adjusting the accelerometer sensor update interval
Updating display object position through accelerometer events
Switching between portrait and landscape based upon device tilt
Detecting whether or not a device supports a geolocation sensor
How it works...
There's more...
See also…
Retrieving device geolocation sensor data
Adjusting the geolocation sensor update interval
Retrieving map data through geolocation coordinates
Chapter 4: Visual and Audio Input: Camera and Microphone Access
Introduction
Detecting camera and microphone support
Using the traditional camera API to save a captured image
Using the Mobile CameraUI API to save a captured photograph
Using the Mobile CameraUI API to save a captured video
Using the device microphone to monitor audio sample data
Recording Microphone Audio Sample Data
Chapter 5: Rich Media Presentation: Working with Images, Video, and Audio
Introduction
Loading photographs from the device cameraRoll
How it works…
There's more…
Applying Pixel Bender Shader effects to loaded images
Playing video files from the local filesystem or over HTTP
Playing remote video streams over RTMP
Playing audio files from the local filesystem or over HTTP
Generating an audio spectrum visualizer
Generating audio tones for your application
Chapter 6: Structural Adaptation: Handling Device Layout and Scaling
Introduction
Detecting useable screen bounds and resolution
Detecting screen orientation changes
Scaling visual elements across devices at runtime
Scaling visual elements based on stage resize in Flash Professional CS5.5
Employing the Project panel in Flash Professional CS5.5
Freezing a Flex application to landscape or portrait mode
Defining a blank Flex mobile application
Defining a Flex mobile view-based application
Defining a Flex mobile tabbed application with multiple sections
Using a splash screen within a Flex mobile application
Configuring the ActionBar within a Flex mobile project for use with ViewNavigator
Hiding the ActionBar control in a single view for a Flex mobile project
Chapter 7: Native Interaction: StageWebView and URI Handlers
Introduction
Opening a website in the default Android browser
Rendering a website within an application
Managing the StageWebView history
Using StageWebView to load ads using ActionScript
Using StageWebView to load ads within a Flex mobile project
Making a phone call from an application
Sending a text message from an application
Invoking Google maps from an application
Invoking the Android Market using application URIs
Sending e-mail from an application
Chapter 8: Abundant Access: File System and Local Database
Introduction
Opening a local file from device storage
Saving a file to device storage
Saving data across sessions through local shared object
Storing application state automatically by using Flex
Creating a local SQLite database
Providing a default application database
Automating database tasks with FlexORM
Chapter 9: Manifest Assurance: Security and Android Permissions
Introduction
Setting application permissions with the Android Manifest file
Preventing the device screen from dimming
Establishing Android custom URI schemes
Anticipating Android Compatibility Filtering
Instructing an application to be installed to Device SDCard
Encrypting a local SQLite database
Chapter 10: Avoiding Problems: Debugging and Resource Considerations
Introduction
Debugging an application with Flash Professional
Debugging an application with Flash Builder
Rendering application elements using the device GPU
Automating application shutdown upon device interruption events
Exiting your application with the device back button
Monitoring memory usage and frame rate in an application
Chapter 11: Final Considerations: Application Compilation and Distribution
Introduction
Generating a code-signing certificate using Flash Professional
Generating a code-signing certificate using Flash Builder
Generating a code-signing certificate using FDT
Generating a code-signing certificate using the AIR Developer Tool
Preparing icon files for distribution
Compiling an application using Flash Professional
Compiling an application using Flash Builder
Compiling an application when using FDT
Compiling an application using the AIR Developer Tool
Submitting an application to the Android Market

Book Details

ISBN 139781849691420
Paperback372 pages
Read More