载入图像如何转换成BitmapData


代码如下:
var url:String="1.jpg";
var request:URLRequest=new URLRequest(url);
var bmp:Bitmap;
var bmpData:BitmapData = new BitmapData(100,100);
var loader:Loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.load(request);

function completeHandler(event:Event) {
       var loader:Loader=Loader(event.target.loader);
       bmp = Bitmap(loader.content);
       bmpData.draw(bmp);
       addChild(bmp);
}

你可能感兴趣的:(bitmap)