1
votes

I'm quite new to Flex.

I've looked into taking screenshots in flex and have found many links on google and here on stackoverflow for taking screenshots of components and stuff like this. What I would like to do is take a screenshot of the entire tab in a browser window (or, failing that, the browser window itself or even just the screen).

I'm able to take a screenshot of a viewstack because it implements the IBitmapDrawable interface. But what if I want to take a screenshot of the browser tab as mentioned? Is this possible and, if so, how?

The parent of the viewstack is the application but when trying to pass Application.application to the draw method of the BitmapData class, I get the following error:

Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:IBitmapDrawable.

Thanks in advance.

2

2 Answers

4
votes

It's not possible to take screenshots of anything that's outside of your Flex application. However, it should be possible to take a screenshot of your application. Application is a DisplayObject which implements IBitmapDrawable. The reason for your error is, that Application.application is of type Object. So, you should be able to cast your application as IBitmapDrawable and use it to get a screenshot of your application.

// Flex 3.x
var app:IBitmapDrawable = Application.application as IBitmapDrawable;

// in Flex SDK 4.x Application.application is deprecated so use
var app:IBitmapDrawable = FlexGlobals.topLevelApplication as IBitmapDrawable;
2
votes

Sorry, but it is not possible to take screenshots of the complete browser window or tab. You can also capture what runs inside of Flash Player. This is a security issue.

When dealing with Adobe Air applications, this is different, as you have a stronger connection to native OS functions.

If this helps, please vote for the answer.