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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.