动态设置flash背景图片
程序员文章站
2024-01-19 09:26:10
...
import flash.display.*;
imgLoader("bg.jpg");
var loader:Loader;
function imgLoader(_path:String ):void{
loader = new Loader;
loader.contentLoaderInfo .addEventListener (Event.COMPLETE , imageComplete);
loader.load(new URLRequest (_path));
}
function imageComplete(_evt:Event):void{
var bitmapData:BitmapData = _evt.target.content.bitmapData;
graphics.beginBitmapFill (bitmapData, new Matrix(), true, true);
graphics.drawRect (0, 0, stage.stageWidth, stage.stageHeight );
loader.contentLoaderInfo .removeEventListener (Event.COMPLETE , imageComplete);
loader = null;
}