I am having a bit of trouble, I have l modded some code that I am really happy with, it makes buttons bounce around for the user to try to click on when entering a certain frame...
Problem.. I notice tha the code adds eventlisteners ENTER_FRAME to make this work, when you leave that frame there are now problems with null objects becuase the listeners are still on but the objects are not there anymore..
Ok so attempted solution - I can use a currentLabel on the main timeline to check if the correct frame is reached then use a function if (label is x) put listeners on else take them off... works but then I have to have these objects hidden on the timeline and then add visible=true/false to my framelabel listener.. This works but part of my functionality here is that these movieclips that move are buttons that the user clicks on and they explode and dissapear- but now they dont because I have a code that says on that frame they should be visible..
The only thing I can think of is to have a blank frame at the end of the explode and put a stop on it. Then add a gotoAndPlay(1) into my frame label code. Seems very ugly, you guys got a better way? Can I remove eventlisteners on leaving a frame? Is there a code like LEAVE_FRAME????
use the removedfromstage event:
yes, it goes in the keyframe where those movieclips exist. if the movieclips exist on a main timeline frame, that's where that code should be placed.
that code should execute when the movieclip exists. the listeners wait for the movieclips to be removed from the display list. that happens when you navigate away from the frame that contains those movieclips.
Europe, Middle East and Africa