Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Developer
ezhil
Posts: 17
Registered: ‎07-16-2008
My Device: Not Specified

Screen Capture

Hi,

 

I need to know whether is there any API to capture screen and store it in Bitmap.

 

Thanks

Developer
willyyr
Posts: 229
Registered: ‎08-14-2009
My Device: Bold 9900, DevAlpha A

Re: Screen Capture

A simple search for the word "screenshot" and you would have found this really usefull post from peter who shared his screenshot function. See: http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Screenshot-for-submission/m-p/727...

Willy R.
-
If my post solved your problem, make it easier for others to find by Accepting it as a solution or provide a Kudo if it was helpful for you. Thanks.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Screen Capture

If you're trying to get a bitmap of something in your app from your app, consider getSnapshot:

 

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/utils/BitmapUtil.html

 

 

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Screen Capture

John, is that the right link?  It goes to spark.utils.BitmapUtil, but doesn't show any function called getSnapshot().  It's also odd that the main list of packages (upper left frame) doesn't even include spark.utils.

 

I have no idea why that is so (temporary glitch?), but in case it helps here's another page that mirrors the info that was probably there.

 

Also, in case this particular mx. package works, mx.graphics.ImageSnapshot has two routines that may work, captureBitmapData() and captureImage().


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
studiochris
Posts: 165
Registered: ‎10-26-2010
My Device: BlackBerry® PlayBook™

Re: Screen Capture

 

var bitmapData:BitmapData = new BitmapData(displayObject.width, displayObject.height, [transparent:Boolean = true], [fillColor:uint = 0xFFFFFFFF]);

bitmapData.unlock();
bitmapData.draw(displayObject);
bitmapData.lock();

var bitmap:Bitmap = new Bitmap(bitmapData);
addChild(bitmap);

 

 

Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Screen Capture

getSnapshot is a static method, first one in the list of public methods at

 

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/utils/BitmapUtil.html

 

 

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Screen Capture

Initially that was not on the page for me.  Only "constructor" and "prototype" were showing, and spark.utils wasn't even in the list.

 

I was able to get it to show by changing the "Products filter" at the top to "Flash CS5 and earlier" instead of what I had it on before which was "No Flash Professional".  It's unfortunate those filter settings aren't exposed in the URL so we can rely on the links we paste to show others the same thing we see.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!