Book Image

Flash Development for Android Cookbook

By : Joseph Labrecque
Book Image

Flash Development for Android Cookbook

By: Joseph Labrecque

Overview of this book

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.
Table of Contents (18 chapters)
Flash Development for Android Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface

Using Flash Builder 4.5 to develop Android applications


Flash Builder 4.5 already comes equipped with everything, we need to begin developing mobile applications using either ActionScript or the mobile Flex Framework. For those unfamiliar with the differences between ActionScript and Flex, basically, the Flex framework provides a set of components, layouts, and data control that is preconfigured for building Flash applications, whereas when using ActionScript by itself, everything must be written from scratch. Flex 4.5 includes mobile features such as optimized component skins to run very well on devices, a new ViewNavigator application type, which is tailored to the mobile experience, and includes support for touch and gestures across the mobile-optimized component set.

How to do it…

In place of a normal ActionScript project or Flex project, we must specifically create either an ActionScript Mobile project or Flex Mobile project:

  1. 1. In the Flash Builder Package Explorer, right-click on some empty space and choose New | Flex Mobile Project or New | ActionScript Mobile Project:

  2. 2. We will then provide the mobile project with a name and choose where Flash Builder should store the project files on the local machine.

  3. 3. The next step allows us to choose the target platform, in this case, Google Android, and define which application template to use (if you are making use of the mobile Flex framework). We can also set the default View name on this screen through the Initial view title input..

  4. 4. Additionally, we will choose whether or not the application will reorient based upon device tilt with the Automatically reorient option. We can select to display the application at full screen by selecting the Full screen checkbox.

  5. 5. One last selection to make on this screen is whether we would like to use density aware skins in our mobile components by selecting the Automatically scale application for different screen densities checkbox and selecting the appropriate Application DPI setting.

  6. 6. The rest of the project setup is really the same as any other project in Flash Builder.

How it works…

The choices we make when setting up a new project in Flash Builder determine which libraries are imported, and used in an application. Defining a mobile application will not only include specific component skins targeted to mobile, but will also restrict us from using components, which are inappropriate for such use. We will also have full access to mobile-specific application structures such as the mobile ViewNavigator, ActionBar, or TabBar. These additions to the mobile Flex framework can be used to greatly speed up the development of stateful mobile Android applications, as they deal with application structure, navigation controls, and layout.

See also…

You can actually use previous versions of Flash Builder to compile AIR for Android applications. Check out the next recipe, Enabling Flash Builder 4 or Flex Builder to access Flex Mobile SDKs for an example of this.