Hi.
I create an instance of Loader class. Then use it to load a png file.
However, I cannot change the loader's width and height.
Code:
var _url:URLRequest = new URLRequest("a.png");
var _loader:Loader = new Loader();
_loader.load(_url);
this.addChild(_loader);
If I just type the code above, the png file will be loaded. But if I add
a new line:
_loader.width = 50;
The picture disappeared when I run the application.
If I change the with property in a event listener:
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);
...
private function onLoad(event:Event):void
{
_loader.width = 50;
}
the loader will change the width property successfully.
I just wanna know why I must place the changing width code in the onLoad
function?
Thanks!