Highlighted

drawViewPortToBitmapData issue on AIR 13.0.0.42

Participant ,
Feb 27, 2014

Copy link to clipboard

Copied

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;

}

TOPICS
Air beta

Views

1.8K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

drawViewPortToBitmapData issue on AIR 13.0.0.42

Participant ,
Feb 27, 2014

Copy link to clipboard

Copied

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;

}

TOPICS
Air beta

Views

1.8K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 27, 2014 0
Participant ,
Mar 03, 2014

Copy link to clipboard

Copied

I am waiting for reply.

Thanks.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 03, 2014 0
Adobe Employee ,
Mar 05, 2014

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 05, 2014 0
Participant ,
Mar 05, 2014

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 05, 2014 0
Adobe Community Professional ,
Mar 05, 2014

Copy link to clipboard

Copied

There are many cases where no_scale would not be appropriate, so it doesn’t really help if it solves the issue here.

Also, what is a mobile use case for exact_fit? As that would distort the stage, it could well be the cause of the problems you’re having.

How do things look if you use the default of show_all or you use no_border?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 05, 2014 0
Participant ,
Mar 05, 2014

Copy link to clipboard

Copied

I have been testing on Galaxy S3 and encountering same issue which is 2x zoomed snapshot when i use StageScaleMode.SHOW_ALL, StageScaleMode.NO_BORDER or StageScaleMode.EXACT_FIT.

I have been getting correct result when i use StageScaleMode.NO_SCALE but this time StageWebview seems near the middle of the device.

What can i do in this case?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 05, 2014 0
Participant ,
Mar 10, 2014

Copy link to clipboard

Copied

İ have been checking this issue but still an issue on AIR 13.0.0.55 which publised on labs page at 6 March.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 10, 2014 0
New Here ,
Jun 08, 2016

Copy link to clipboard

Copied

any updates?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 08, 2016 0