I have a 100 x 100 html component that has the location of a site as it's location so obviously an image of this site appears within the component. How can I scale this down so that the image is also 100 x 100? Scalex and scaley only scale the component itself not it's contents/image.
Obviously it's easy to do this with a regular image component as you just resize the image itself manually but this obviously can't be done with websites. Here is the component:-
<mx:HTML location="http://www.yahoo.com/" height="100" width="100"/>
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.
Europe, Middle East and Africa