Hey guys,
I usually don’t ask too many coding questions but I am stumped. I am loading a swf (that has a enter_frame event listener in it) into a movieclip , and when I go to remove that swf I use unloadAndStop(), but the enterframe event is still firing and throwing a #1009 Error .
It is deleting the swf, but I am told that it will get rid of everything in the loader including the event listeners, and Its not. Anyone experience something like this before or have a solution. I am using CS5 , AS3.
Thanks Scott
did you try adding a removed from stage listener in the loaded swf to brute-kill the frame listener. might work
Weird that it doesn’t work though, should do so according to specs
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Author had a Free File of the Month
- Exclusive Author
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Europe
- Has been a member for 3-4 years
- Referred between 10 and 49 users
I have never tested unloadAndStop() myself, but when I heard about it I thought this is just a collection of generic commands like SoundMixer.stopAll and such.
I am not sure how is it suppose to remove the events, timers, tweens and other stuff you added internally in your application.
PJ,
Thanks for your suggestion, I implemented the REMOVED _FROM_STAGE event and it worked like a charm, here is what I used if anyone has the similar problem.
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
function removed(e:Event):void { if (e != null) { //here remove any listeners //moviecilpname.removeEventListener(Event.ENTER_FRAME, functionname); this.removeEventListener(Event.REMOVED_FROM_STAGE, removed); } }
Thanks again Patrick and Tean.
Scott
no sweat… i’ve run into unloading issue myself before. Event.UNLOAD gave me some unfair errors and now I simply use both and make sure that on unload i also remove the child from stage right away. Seems to work ok.
