loaded image cannot be seen on the screen
I load many images simultaneously with different Loader class. When l开发者_高级运维oaded I add content of loaders to the movieclips which are child of some other movieclip which is child other... I check that images are loaded addChild method is called, but loaded images cannot be seen on the screen.
Actually, sometimes images can be seen, but sometimes cannot be seen.
Do I need to rerender some DisplayObject? Something similar...
import flash.display.Loader;
import flash.display.Sprite;
import flash.net.URLRequest;
public class Image {
private var _loader:Loader;
public function Image(src:String) {
_loader = new Loader();
_loader.load(new URLRequest(src));
}
public function get loader():Loader {
return _loader;
}
}
Then when you load the images:
public function loadImages(images:XML):void {
var _i:Image;
for each(var image:XML in images) {
_i = new Image(image.src);
_i.loader.contentLoaderInfo.addEventListener(Event.COMPLETE, addImage);
}
}
private function addImage(e:Event):void {
parent.addChild(e.target.content);
}
精彩评论