Skip to main content
jasonjam
Inspiring
October 15, 2008
Question

Replaying a video

  • October 15, 2008
  • 1 reply
  • 723 views
Hello,

I'm new to using AS3 and was hoping someone can help me out with the code to replay a video once it completes. I pasted an example of the code I use in AS2 and it works perfectly.

My goal is to run the movie keeping the replay button or movie clip invisible until the movie ends.

AS2 example-

replayClip._visible = false;

var playbackComplete:Object = new Object();
playbackComplete.complete = function(eventObject:Object):Void {
child.stop();
replayClip._visible = true;
replayClip.gotoAndPlay(1);

};
child.addEventListener("complete", playbackComplete);

Thanks for your help.
This topic has been closed for replies.

1 reply

Inspiring
October 15, 2008
Hi,

This should do it:

import fl.video.VideoEvent; // Declare this at the beginning of your code


myVideo.addEventListener(VideoEvent.COMPLETE, playAgain);

function playAgain(evt:VideoEvent):void
{
myVideo.play();
}

Kind Regards,

Boxing Boom
jasonjam
jasonjamAuthor
Inspiring
October 15, 2008
Hi,

This code worked in replaying the video but it's not exactly how I want it to happen.

Once the video is complete, I need to have a replay button become visible and have the user decide if they want to replay the video, not the video replaying automatically.

In my AS2 example, replayClip._visible = false; is on top of my video and becomes true once the video is complete and allows the user interactive to replay the video.

Hopefully you can help me out further.

Thanks again.
Inspiring
October 15, 2008
Jason,

Post the code you've got so far in your fla. I just want to see that you've got a little bit of AS3 in ya ;)


Kind Regards,

Boxing Boom