When working with multiple bitmap resources, you may want to consider using a sprite sheet. A sprite sheet is a single bitmap that holds a collection of individual images. Typically, the sheet is separated into a grid with each image occupying identically sized slots.
Once a sprite sheet is loaded into memory, the bitmap data for its individual images can be extracted and stored separately. This allows the data for each image to be accessed quickly by the application.
Let us see how this is done.
From the book's accompanying code bundle, open chapter6\recipe8\recipe.fla
. The majority of the FLA's AIR for iOS settings have been applied as a starting point.
Additionally, a bitmap named sprite-sheet.png
has been provided within the same folder as the FLA. Take a look at the bitmap in an image editor such as Adobe Photoshop. It contains a collection of images that we will extract and store in memory.