var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); var request:URLRequest=new URLRequest("~规格.swf"); loader.load(request); addChild(loader); function initHandler(event:Event):void { //var loader:Loader=Loader(event.target.loader); var info:LoaderInfo=LoaderInfo(loader.contentLoaderInfo); trace("initHandler: loaderURL=" + info.loaderURL + " url=" + info.url) trace(info.height,info.width); } function completeHandler(event:Event):void{ event.target.content.width=1600 trace(loader.contentLoaderInfo.width,event.target.content.width) //trace("宽",info.width,"高",info.height) } function ioErrorHandler(event:IOErrorEvent):void { trace("ioErrorHandler: " + event); }
时间: 2024-12-21 19:05:54