开发者

Actionscript 3, loading image from web

开发者 https://www.devze.com 2023-03-24 18:19 出处:网络
I\'m trying to load an external image into my air app. CODE HERE (http开发者_开发百科://pastie.org/2314164)

I'm trying to load an external image into my air app.

CODE HERE (http开发者_开发百科://pastie.org/2314164)

xml.artist_pic is pointing to image example: http://www.example.com/image.jpg GLOBAL.skin.albumArt is a movie clip which inside has bitmap.

What am I doing wrong?


You need to use the Loader class instead of URLLoader

var loader:Loader = new Loader();
loader.load(new URLRequest(url));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);

function imageLoaded(e:Event):void {
   var image:Bitmap = (Bitmap)(e.target.content);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消