views:

14

answers:

1

Hello. I have a movieclip that contains two frames, each frame contains a different set of buttons.

it seems that i cannot add the event listeners to buttons that are not in my current viewed frame.

so.. problem one: is there a way to add event listeners to all the elements in the movieclip even if the elements are in a different frame.

problem two: after I added an event listener to some elements in current frame and then I move forward to the next frame and go back to the same frame, all the event listeners are removed and i need to initialize them again. is there a way to resolve the issue without the need to re-initialize the event listeners ?

thank you for your help!

+1  A: 

I don't think so, but..

The way I worked around this problem was pretty simple. I put the event listener intializing code in the timeline, specifically on the frame that contains the element that dispatches the event.

It solves both of your problems. The listeners will only be active, when you're on that specific frame.

SomeBloke
thank you. i chose not to work with frames at all, i just created all the required elements on the constructor of the movieclip and then i would show and hide the relevant ones.
ufk