PDA

View Full Version : Need EventListener to go to frame 1 after movie clip stops playing


nture
03-06-2008, 09:06 PM
Using Flash Professional 8. I have a menu with a Play Movie button on frame 1, and a movie clip on frame 2. On Frame 1, the action script reads:

stop();

myBtn_btn.onRelease = function(){
gotoAndStop(2);
};

Thus, on the release of the button on frame 1, it goes to frame 2 and begins to play the flv movie clip (using FLVPlayback). After 9 minutes, when the movie clip is over, it stays on frame 2 and the playhead of the movie clip goes back to the beginning.

Instead of staying on frame 2, I’d like it to go back to frame 1 (the menu) once the movie clip stops playing.

Should I use an EventListener? What script should I use to tell it to go to frame 1 at the end of the 9-minute movie clip?

Thanks for any help.

xxneon
03-06-2008, 09:10 PM
function complete(evt){
gotoAndStop(1);
}
FLVPlayBack.addEventListener("complete",complete);

that should do it .. just change the FLVPlayBack to the instance name of your component in your frame 2.

this code would go on frame 2 also..

nture
03-06-2008, 09:45 PM
Perfect! Thanks xxneon. That was exactly it.
It works now.