Loading bitmaps at runtime

It is a common practice to minimize an app's up-front load time and memory footprint by loading graphics resources on demand. When making use of bitmaps, it is possible to store them outside of your app's binary and use ActionScript to load them at runtime when required.

Let us see how this is done.

Getting ready

An FLA has been provided as a starting point.

From the book's accompanying code bundle, open chapter6\recipe7\recipe.fla into Flash Professional. Its AIR for iOS settings have been applied and a dynamic text field has been added at the bottom of the stage.

Additionally, chapter6\recipe7\monkey.png has been provided, which is the bitmap we will load at runtime.

How to do it...

This recipe is split into two parts. First, ...

Get Flash iOS Apps Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.