1 person found this helpful
I'm assuming that you are trying to create thumbnails of different websites. Thus you don't need any interactivity. The HTML control can't scale its content and you probably don't want users clicking in it.
I've created a Flex 4 example that takes a snapshot of the web page and displays it in an Image tag. You'll probably want to optimize this a bit. BitmapData can be memory intensive, so in the draw command you might want to scale the image down by passing in a matrix. When you are done with the BitmapData, remember to call dispose() to free it up for garbage collection.
<?xml version="1.0" encoding="utf-8"?>
protected function button1_clickHandler(event:MouseEvent):void
// TODO Auto-generated method stub
content.location = location.text;
protected function button2_clickHandler(event:MouseEvent):void
var bd:BitmapData = new BitmapData(800, 600, false);
var bm:Bitmap = new Bitmap(bd);
snapshotHolder.source = bm;
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:TextInput id="location" width="80%"/>
<s:Button label="Go" click="button1_clickHandler(event)"/>
<s:Button label="Create Snapshot" click="button2_clickHandler(event)"/>
<mx:Image id="snapshotHolder" width="100" height="100" scaleContent="true"/>
<mx:HTML width="800" height="600" id="content"/>
The problem for me is that I don't have flex 4 only flex 3 and I've never used flex 4 at all. When I get the solution for this I need to implement it into an existing flex 3 air application I've made. Is there any way of me producing this example in a flex 3 app?
Cheers for your help so far.
Oh and by the way what you mentioned in your first sentence "thumbnails of websites" is exactly what I'm after. It's just that as you say I need the images to be non interactive too.
The thing with the HTML Component is you need to specify the width and height size not in percentages for the bitmapdata to have all the HTML Content of the webpage.