Jump to content
Search Community

Reply button on Adobe Animate CC?

fadyhenen test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Thank you Jack, for you instant answer 

 

I meant a button to make the banner Repeat after the animation ends.

So when the people want to see the animation again they can click on it

 

I attached a picture to what I mean a button as shown.

29209-200.png

Link to comment
Share on other sites

If you're doing timeline animation, all you need to do is create a replay button symbol, give it an instance name of "replay" and add this code & your button to the end frame:

 

this.replay.addEventListener("click", fl_ClickToGoToAndPlayFromFrame.bind(this));
 
function fl_ClickToGoToAndPlayFromFrame()
{
  this.gotoAndPlay(1);
}

 

Be sure to put the replay button on a layer above your clickTag button or the replay functionality won't work.  Also, you have to use a button and not target the whole canvas... that issue comes up a lot on the Animate CC forums: https://forums.adobe.com/message/8720575

  • Like 3
Link to comment
Share on other sites

I Tried it, but it's not working,

 

when I change the frame to 0 it works first time and then when I click the banner it opens multiple pages?

 

 

this.replay.addEventListener("click", fl_ClickToGoToAndPlayFromFrame.bind(this));

 function fl_ClickToGoToAndPlayFromFrame()
  {

   this.gotoAndPlay(0);
}
    

My timeline

________________________

var root = this,
    tl; 
 
tl = new TimelineMax( { repeat: 1, repeatDelay: 1 } );

tl
.addLabel( 'myLabel1' )


.from( this.t1, 1, { alpha:0,x:this.t1.x-50,  ease:Expo.easeOut  }, 'myLabel1+=1' )

.to( this.t1, 0.75, { alpha:0,  ease:Expo.easeOut }, 'myLabel1+=4' )


.from( this.t2, 1, { alpha:0,x:this.t2.x-50,  ease:Expo.easeOut  }, 'myLabel1+=4.5' )
.from( this.t3, 1, { alpha:0,x:this.t3.x-50,  ease:Expo.easeOut  }, 'myLabel1+=5' )

.to( this.t2, 0.75, { alpha:0,  ease:Expo.easeOut }, 'myLabel1+=7' )
.to( this.t3, 0.75, { alpha:0,  ease:Expo.easeOut }, 'myLabel1+=7' )


.from( this.t4, 1, { alpha:0,x:this.t4.x-50,  ease:Expo.easeOut  }, 'myLabel1+=7.5' )
.from( this.t5, 1, { alpha:0,x:this.t5.x-50,  ease:Expo.easeOut  }, 'myLabel1+=8' )

 

.addLabel( 'myLabel2' )


.from( this.seemore, 0.75, { scaleX:0, scaleY:0,alpha:0, ease:Back.easeOut }, 'myLabel2' )
.from( this.reply, 1, { scaleX:0, scaleY:0,alpha:0, ease:Back.easeOut }, 'myLabel2+=2' )
 

 

 

Link to comment
Share on other sites

Make sure your instance names match up.  replay not reply.

 

Since you're using scripted animation with GSAP and not the Animate timeline, you should use

 

this.replay.addEventListener("click", clickToReplay.bind(this));
 function clickToReplay()
  {
   tl.restart();
}

 

  • Like 3
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.
×
×
  • Create New...