ステージに画像を読み込もうとしています。私は次のコードを使用します:
public function loadImg():void{
var iLoader:Loader = new Loader();
iLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressStatus);
iLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderReady);
var fileRequest:URLRequest = new URLRequest(imgPath+'testimg.JPG');
iLoader.load(fileRequest);
}
public function onProgressStatus(e:ProgressEvent) {
trace(e.bytesLoaded, e.bytesTotal);
}
public function onLoaderReady(e:Event) {
this.stage.addChild(iLoader); // error is here
}
ただし、iLoaderがonLoaderReadyに見つからないようです。
1120: Access of undefined property iLoader.
オブジェクトiLoaderをこの関数に渡すにはどうすればよいですか?それとも私は何か間違ったことをしていますか?
よろしくお願いします!:D