Using StageWebView as background for your app in Flex.

Basic thing about StageWebView class is that it is used to display html content in your app. To be more clear on that it is ‘rendered above all display list content’. Now having said that you cannot place/put other content like flex controls/components like a Button or List on above it.

[wp_ad_camp_1]

But what if you have a requirement where you just want to capture the html content rendered using StageWebView and apply it as a background to your app. I would say ‘Yes we can do this’. Because  i have seen the source code of it. Source code is not available within the Flash Builder as it is part of ‘flash.media.StageWebView’ package and from airglobal.swc, but you can check out the online docs. So In that class there’s a method called ‘drawViewPortToBitmapData'(actual signature is given below), so using this we can actually capture a snapshot of the html content rendered using the StageWebView, which gives us the BitmapData and you can apply this BitmapData object as source to your image component in Flex or as a background for your app.

drawViewPortToBitmapData(bitmap:BitmapData):void

Hope this post helps someone.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: