actionscript 3 - progress event triggering on complete event -
i trying load swf2 inside swf1 , show swf2's loading progress. after doing progressevent.progress triggering when swf2 downloads completely. please suggest me change. have done as
import flash.display.loader; import flash.events.event; import flash.events.progressevent; import flash.events.ioerrorevent; var myloader = new loader(); myloader.contentloaderinfo.addeventlistener(progressevent.progress, onprogress); myloader.contentloaderinfo.addeventlistener(event.complete, oncomplete); myloader.contentloaderinfo.addeventlistener(ioerrorevent.io_error, onioerror); myloader.load(new urlrequest("swf/set1.swf")); function onprogress(evt:progressevent):void { var npercent:number = math.round((evt.bytesloaded / evt.bytestotal) * 100); temp.text = npercent.tostring() + "%"; } function oncomplete(evt:event):void { myloader.contentloaderinfo.removeeventlistener(progressevent.progress, onprogress); myloader.contentloaderinfo.removeeventlistener(event.complete, oncomplete); addchild(myloader); } function onioerror(evt:ioerrorevent):void { trace("ioerror loading swf"); }
Comments
Post a Comment