I've got some "puppets" that give various audio feedback to
students during a game. They slide on, say the audio, and
(hopefully) slide back out. Sometimes however, they don't slide
Here is how the puppet is set up.
blank keyframe with a stop();
A label "enter" on frame 2 with the slide into screen part
A label "loop" on frame 8 that starts the mouth moving.
A keyframe with code on frame 27 that sends the movie back to
A label "exit" on frame 28 that stops the mouth and then
slides the puppet off screen.
Where it loops around to frame 1 to be ready for the next
time it is needed.
Then on my main timeline I have the code below which sends in
the puppet, starts a specific sound, waits for the sound to finish
and then sends the puppet out.
The problem is the sounds are of various lengths and due to
various loads on the player even the same sound will take a
different number of frames to complete.
If the puppet is on frame 27, the one where the code sends it
back to loop, then the code on the puppet instance "overrides" the
code in the function. In other words, function says,
"gotoAndPlay("exit")" but the puppet's timeline says
"gotoAndPlay("loop")" and the puppet's timeline "wins."
My thought is to add an onEnterFrame to the function that
will cancel after one frame and have it send the puppet to exit
again. If it was already send it will just be there anyway and if
it wasn't set it will go there. What do you think? Any other