Many iOS applications allow the user to save an image to the camera roll. Drawing tools and avatar creators are popular examples, where the user can easily show off their creation to friends and family from the device's native photo gallery.
This recipe will show you how to save a snapshot of the stage to the device's camera roll.
From the book's accompanying code bundle, open chapter10\recipe1\recipe.fla
into Flash Professional.
You will find two bitmaps and a movie clip sitting on the stage. The bitmaps have been composited to produce a background image, which we will save to the camera roll. The movie clip represents a button and will initiate the save when pressed.
The button movie clip has an instance name of saveBtn
and its library symbol is linked to a class named Button
. This class was introduced in the Handling user interaction recipe from Chapter 4.
Okay, let us write some code.