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.
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.
In addition to StageWebView
, we will make use of the Bitmap
and BitmapData
classes to store and display the snapshot.
Create a new document class and name it
Main
.Add the following import statements and declare a
StageWebView
member variable:package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.MovieClip...