YAOMK
12-31-2008, 05:14 AM
What am I doing wrong? I keep getting a blank bitmap:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="592" height="391">
<mx:HTML id="browser" color="black" width="50%" height="344" location="http://actionscript.org" y="45" x="10"
creationComplete="drawImage()">
</mx:HTML>
<mx:HBox x="0" y="0" width="700" height="27">
<mx:TextInput width="329" id="URL"/>
<mx:Button label="Go" id="Go" labelPlacement="left" click="browser.location = URL.text"/>
</mx:HBox>
<mx:Script>
<![CDATA[
import flash.display.Bitmap;
import flash.display.BitmapData;
private var bmpd:BitmapData;
[Bindable]
public var bmp:Bitmap;
public function drawImage():void
{
bmpd = new BitmapData(browser.width, browser.height);
bmpd.draw(browser);
bmp = new Bitmap(bmpd);
}
]]>
</mx:Script>
<mx:Image id="picture" source="{bmp}" x="346" y="45" width="{browser.width}" height="{browser.height}"/>
</mx:WindowedApplication>
[EDIT]: I probably should have submitted this post to the AIR forum. Please relocate if appropriate.
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="592" height="391">
<mx:HTML id="browser" color="black" width="50%" height="344" location="http://actionscript.org" y="45" x="10"
creationComplete="drawImage()">
</mx:HTML>
<mx:HBox x="0" y="0" width="700" height="27">
<mx:TextInput width="329" id="URL"/>
<mx:Button label="Go" id="Go" labelPlacement="left" click="browser.location = URL.text"/>
</mx:HBox>
<mx:Script>
<![CDATA[
import flash.display.Bitmap;
import flash.display.BitmapData;
private var bmpd:BitmapData;
[Bindable]
public var bmp:Bitmap;
public function drawImage():void
{
bmpd = new BitmapData(browser.width, browser.height);
bmpd.draw(browser);
bmp = new Bitmap(bmpd);
}
]]>
</mx:Script>
<mx:Image id="picture" source="{bmp}" x="346" y="45" width="{browser.width}" height="{browser.height}"/>
</mx:WindowedApplication>
[EDIT]: I probably should have submitted this post to the AIR forum. Please relocate if appropriate.