简体   繁体   中英

Actionscript 3, loading image from web

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM