Book Image

Flash iOS Apps Cookbook

By : Christopher Caleb
Book Image

Flash iOS Apps Cookbook

By: Christopher Caleb

Overview of this book

The latest version of Flash Professional can directly target iOS, allowing Flash developers to write applications that will run natively on Apple's iPhone, iPad, and iPod touch. What's more, with Apple loosening its restrictions on third-party technologies, apps written in Flash can now be sold and distributed within the App Store.Flash iOS Apps Cookbook provides the recipes required to build native iOS apps using your existing knowledge of the Flash platform. Whether you want to create something new or simply convert an existing Flash project, the relevant steps and techniques will be covered, helping you achieve your goal.Learn how to configure and use Flash Professional for iOS development by writing and deploying a simple app to a device. Implement many iOS-specific features such a multi-touch, the virtual keyboard, camera support, screen orientation and the Retina display. Overcome the limitations of mobile development by mastering hardware acceleration and optimization. Whether you're an enthusiast or professional developer, the Flash iOS Apps Cookbook is your toolkit to creating high-quality content for iPhone, iPad and iPod touch.
Table of Contents (21 chapters)
Flash iOS Apps Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Capturing a snapshot of a web page


It is possible to copy the contents of a StageWebView object's viewport into a bitmap.

In this recipe, we will capture a snapshot of a web page and display a thumbnail of the bitmap below the page's viewport.

Getting ready

The steps covered in this recipe are only applicable to those using Flash Professional CS5.5 and AIR 2.6 or above. Flash Professional CS5 and AIR 2.0 do not provide support for the StageWebView class.

From the book's accompanying code bundle, open chapter11\recipe6\recipe.fla into Flash Professional CS5.5. The FLA's stage is empty but its AIR for iOS settings have already been applied.

How to do it...

In addition to StageWebView, we will make use of the Bitmap and BitmapData classes to store and display the snapshot.

  1. Create a new document class and name it Main.

  2. Add the following import statements and declare a StageWebView member variable:

    package {
    
      import flash.display.Bitmap;
      import flash.display.BitmapData;
      import flash.display.MovieClip...