How to detect when nested movieclip reaches last frame
I would be grateful for help - it seems like something standard but I can't work out how to do it, and I would like to do it neatly:
I want to be able to detect when a nested movieclip reaches its last frame so that:
1. it (the movieclip) and its parent (example1) can be removed, and
2. a new movieclip (example2) can replace it.
I have:
1. a document class, to which is added dynamically:
2. mc_background, to which is added dynamically:
3. mc_example1, to which is added dynamically (on frame 3)
4. mc_try(this is several frames with a navigation button). (note: I have added mc_try to mc_example on frame 3 where it is needed, because it was the only way I could get stage.focus on the input textfield on mc_try to work with flashing cursor.)
I need -- mc_background to detect -- when mc_try reaches its last frame so that mc_example1(parent of mc_try) can be removed and replaced with mc_example2.
I thought this could be done with an event dispatcher on last frame of mc_try but I don't understand how to get mc_background to detect when this event occurs. Perhaps with enterframe but I thought this was bad practice.
Any help gratefully received.
|