0
我在舞台上有一个按钮和进度条。我试图加载一个图像在闪光灯的同一个文件夹,但它没有工作。我收到以下错误:文件加载时出错
1119:通过 静态类型flash.net:URLLoader参考可能未定义的属性的contentLoaderInfo的访问。
和:
1067:的DisplayObject:类型flash.net:URLLoader对无关型flash.display使用一个值的隐式强制。
这里是我的代码:
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.MouseEvent;
var myLoader:URLLoader = new URLLoader();
btn_Img.addEventListener(MouseEvent.CLICK, uploadPic);
function uploadPic(event:MouseEvent):void{
myPb.source = myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoad);
myLoader.load(new URLRequest("myImage.png"));
btn_Img = null;
addChild(myPb);
removeChild(myPb);
}
function imageLoad(event:Event):void{
addChild(myLoader);
btn_Img = null;
}
你能教我如何解决这个问题?我尝试了很多方法,但仍然没有把握好。
此代码:myPb.source = myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,imageLoad);有点困惑。想要将侦听器定义与“myLoader”对象的源属性绑定? –