Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Using a button to replay the timeline

Recommended Posts

I'm animating a short movie. At the end of the movie, I want the viewer to have the option of clicking a button that restarts the movie from the beginning.


I used two timelines -- one for each scene of the movie. The first timeline has an onComplete parameter that calls a function instructing the next timeline to play. I'm including this information in case the way I order my timelines has something to do with why they are not restarting. The timelines are not nested.


Here is my last few lines of code. The 'revealReplay' function fade in 'replayText_mc' (which is line of text saying "Click here to replay") when the mouse rolls over 'bigblock_mc'.


The next function should allow the user to click on 'bigBlock_mc' to run the function 'replay' which contains the instructions to restart() my timeline, called 'introTimeline'.


bigBlock_mc.addEventListener(MouseEvent.ROLL_OVER, revealReplay);
function revealReplay(e:MouseEvent):void {
TweenMax.to(replayText_mc, 1, {alpha:1});

bigBlock_mc.addEventListener(MouseEvent.CLICK, replay)
function replay(e:MouseEvent):void {
trace('The Block was clicked');


Both the functions are being read -- it outputs the trace but doe not restart.


Any help would be appreciated! I tried using labels with goToAndPlay but was also unsuccessful.

Link to comment
Share on other sites

Hi dcarrick,

Your code seems sound, so there must be an issue elsewhere, could you post a really simple FLA so we can take a look?



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.