drawViewPortToBitmapData issue on AIR 13.0.0.42
fixed on AIR 3.8 for IOS
https://bugbase.adobe.com/index.cfm?event=bug&id=3161013
Adobe AIR 3.8 relase notes, notable bug fixes:
StageWebView.drawViewPortToBitmapData draws incorrect bitmap on retina devices(3558603)
But this is still an issue on AIR 13.0.0.42 at Galaxy S3 (Android 4.3)
How to solve this problem?
There is an example test file (.fla) at zip: Link
here is the code:
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.MouseEvent
import flash.geom.Rectangle;
import flash.media.StageWebView;
var webView:StageWebView = new StageWebView();
webView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight-100);
webView.stage = this.stage;
webView.loadURL("http://labs.adobe.com/");
var webViewBitmap:Bitmap;
addBitmap.addEventListener(MouseEvent.CLICK, addBitmapClickHandler);
removeBitmap.addEventListener(MouseEvent.CLICK, removeBitmapClickHandler);
function addBitmapClickHandler(event:MouseEvent):void
{
var rect:Rectangle = webView.viewPort;
var bitmapData:BitmapData = new BitmapData(rect.width,rect.height,true,0xff0000);
webView.drawViewPortToBitmapData(bitmapData);
webViewBitmap = new Bitmap(bitmapData);
webView.stage = null;
addChild(webViewBitmap);
}
function removeBitmapClickHandler(event:MouseEvent):void
{
if (contains(webViewBitmap))
removeChild(webViewBitmap);
webView.stage = this.stage;
}
