flash cs5: when i change frames in a movieclip, ev

2019-09-05 22:21发布

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条回答
时光不老,我们不散
2楼-- · 2019-09-05 22:26

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.

查看更多
登录 后发表回答