␡
- Introduction
- Becoming an Apple Certified Developer
- Registering an iPhone and Other Apple Testing Devices
- Creating App IDs
- Creating a Developers Provisioning Profiles
- Creating and Publishing an iPhone App
- Controlling the Accelerometer
- Saving Images to the Camera Roll
- Understanding the Limits of Flash
- Identifying Devices to Deploy an Ad Hoc App
- Creating an Ad Hoc Distribution Profile
- Packaging an Ad Hoc App
- Packaging an App for the iTunes App Store
- Using iTunes Connect to Publish an App
- Using Screen Orientation in an App
- Using Geolocation in an App
- Using Multitouch in an App
This chapter is from the book
Saving Images to the Camera Roll
Adobe does give you access to some core iPhone specific tools. One of those is the ability to add a function that will save an image of the screen to the Camera Roll (New!). The following example saves a screen image to the Camera Roll in an iPhone App.
Save a Screen Image to Camera Roll
- Click the File menu, click New, click iPhone OS, and then click OK.
- Create a new Movie Clip on the Stage with the name snapShot.
- Add the following event Listener to:
snapShot.addEventListener(MouseEvent.CLICK, myScreenShot);
- Add the following function that takes a screen shot of your iPhone:
function myScreenShot (event:MouseEvent):void { if (CameraRoll.supportsAddBitmapData) { var cameraRoll:CameraRoll = new CameraRoll(); cameraRoll.addEventListener(ErrorEvent.ERROR, onCrError); cameraRoll.addEventListener(Event.COMPLETE, onCrComplete); var bitmapData:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight); bitmapData.draw(stage); cameraRoll.addBitmapData(bitmapData); } else { trace("not supported."); } }
- Publish and package your file into an iPhone App and test it on your iPhone.