Load image with Loader and Paint image with graphics
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:HBox width="400" height="300" creationComplete="init()">
<mx:Script>
import flash.net.URLRequest;
private var loader:Loader;
private function init():void
{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeLoad);
loader.load(new URLRequest("logo.jpg"));
}
private function completeLoad(event:Event):void
{
var bm:BitmapData = new BitmapData(loader.width, loader.height, true,0x000000);
bm.draw(this.loader);
var m:Matrix = new Matrix();
m.createBox(this.width/loader.width, this.height/loader.height);
this.graphics.beginBitmapFill(bm, m, true, true);
this.graphics.drawRoundRectComplex(0, 0, this.width, this.height,20, 20, 20, 20);
this.graphics.endFill();
}
</mx:Script>
</mx:HBox>
</mx:Application>
Related examples in the same category