Skip to main content
Inspiring
February 27, 2014
Question

drawViewPortToBitmapData issue on AIR 13.0.0.42

  • February 27, 2014
  • 1 reply
  • 2093 views

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;

}

This topic has been closed for replies.

1 reply

seyfx001Author
Inspiring
March 3, 2014

I am waiting for reply.

Thanks.

Adobe Employee
March 5, 2014

Thanks for reporting the issue, could you please try putting in “NO_SCALE” in your code as following?

stage.scaleMode = StageScaleMode.NO_SCALE;

Regards,

Jitender

Adobe AIR Team

seyfx001Author
Inspiring
March 5, 2014

Yes, it is working fine, thanks.

But i should publish the mobile application for IOS/Android with the code as following:

stage.scaleMode = StageScaleMode.EXACT_FIT

So how can i do to draw the correct bitmap from webview?

Or how can i calculate to the correct viewport from webview?