actionscript 3 - Load swf on loaded swf? -
i'm on project created in flash builder 4.7 , flash professional cs6, nice. need project load's swf inside "preloaded swf",
the first swf, loads second swf,
this second swf "home" of project.
at point, work's perfectly. when "home" try load other external swf, says :
[ioerrorevent type="ioerror" bubbles=false cancelable=false eventphase=2 text="error #2124"]
the code of first swf:
public class initialswf extends movieclip { private var _loader_:loader; private var _applicationcontent_:displayobject; private var _loadercontent_:movieclip; private var _loadericon_:movieclip; public function initialswf() { super(); _loader_ = new loader(); _loader_.contentloaderinfo.addeventlistener(event.complete,_oncomplete_,false,0,true); _loader_.contentloaderinfo.addeventlistener(ioerrorevent.io_error,_onioerror_,false,0,true); _loader_.contentloaderinfo.addeventlistener(progressevent.progress,_onprogress_,false,0,true); _loader_.load(new urlrequest("home.swf")); } private function _oncomplete_(param1:event) : void { _applicationcontent_ = _loader_.content; _applicationcontent_.visible = true; stage.addchild(_applicationcontent_); _applicationcontent_.addeventlistener("onapplicationcomplete",_onapplicationcomplete_,false,0,true); _loader_.contentloaderinfo.removeeventlistener(event.complete,_oncomplete_); _loader_.contentloaderinfo.removeeventlistener(ioerrorevent.io_error,_onioerror_); _loader_.contentloaderinfo.removeeventlistener(progressevent.progress,_onprogress_); _loader_.unload(); _loader_ = null; } private function _onapplicationcomplete_(tmpevt:event) : void { _applicationcontent_.removeeventlistener("onapplicationcomplete",_onapplicationcomplete_); _loadercontent_.addeventlistener("loaderout",_onloaderout_,false,0,true); // } private function _onloaderout_(param1:event) : void { _loadercontent_.removeeventlistener("loaderout",_onloaderout_); _applicationcontent_.visible = true; stage.removechild(this); } private function _onioerror_(tmperror:ioerrorevent) : void { trace(tmperror); } private function _onprogress_(param1:progressevent) : void { var _progress_:number = math.round(param1.bytesloaded / param1.bytestotal * 100); //do animation loading }
and homeswf:
public class secondaryswf extends sprite { private var _loader_:loader; private var _loadercontent_:movieclip; private var _loadericon_:movieclip; private var _applicationcontent_:displayobject; public function secondaryswf() { this.addeventlistener(event.added_to_stage,this._gologin_,false,0,true); } public function _gologin_(tmpevent:event) { _loader_ = new loader(); _loader_.contentloaderinfo.addeventlistener(event.complete,_oncomplete_,false,0,true); _loader_.contentloaderinfo.addeventlistener(ioerrorevent.io_error,_onioerror_,false,0,true); _loader_.contentloaderinfo.addeventlistener(progressevent.progress,_onprogress_,false,0,true); _loader_.contentloaderinfo.addeventlistener(httpstatusevent.http_status, httpstatushandler); _loader_.load(new urlrequest("secondaryswf.swf")); } private function httpstatushandler(event:httpstatusevent):void { trace(event); } private function _oncomplete_(param1:event) : * { _applicationcontent_ = _loader_.content; _applicationcontent_.visible = true; stage.addchild(_applicationcontent_); _applicationcontent_.addeventlistener("onapplicationcomplete",_onapplicationcomplete_,false,0,true); _loader_.contentloaderinfo.removeeventlistener(event.complete,_oncomplete_); _loader_.contentloaderinfo.removeeventlistener(ioerrorevent.io_error,_onioerror_); _loader_.contentloaderinfo.removeeventlistener(progressevent.progress,_onprogress_); _loader_.unload(); _loader_ = null; this.removeeventlistener(event.added_to_stage,this._gologin_); } private function _onapplicationcomplete_(param1:event) : void { _applicationcontent_.removeeventlistener("onapplicationcomplete",_onapplicationcomplete_); _loadercontent_.addeventlistener("loaderout",_onloaderout_,false,0,true); // .. } private function _onloaderout_(param1:event) : void { _loadercontent_.removeeventlistener("loaderout",_onloaderout_); //_applicationcontent_.visible = true; //stage.removechild(this); } private function _onioerror_(tmperror:ioerrorevent) : void { trace(tmperror); } private function _onprogress_(param1:progressevent) : void { var _progress_:number = math.round(param1.bytesloaded / param1.bytestotal * 100); // .. } }
consolechromeswf <-this image of google console.log, , catch this:
- start initialswf
- load homeswf
- complete loaded of homeswf
- start homeswf
- the link of secondary swf (censored/hidden public)
- load secondaryswf
- error
i don't know why secondary swf 100% loaded return error... regards!
Comments
Post a Comment