Skip to main content
Inspiring
Feb 27, 2014 6:29 PM UTC
Question

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;

}

This topic is closed to new replies. Start a new post to keep the conversation going.

7 replies

seyfx001Author
Inspiring
Mar 3, 2014 3:42 PM UTC

I am waiting for reply.

Thanks.

Translate
Adobe Employee
Mar 5, 2014 10:44 AM UTC

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

Translate
seyfx001Author
Inspiring
Mar 5, 2014 12:38 PM UTC

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?

Translate