- <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"
- creationComplete="createFill()" cornerRadius="20">
- <mx:Script>
- <![CDATA[
- import flash.net.URLRequest;
- private var loader:Loader;
- private function createFill():void
- {
- loader = new Loader();
- loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
- completeLoad);
- loader.load(new URLRequest("../../assets/beach.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>