Jump to content
GreenSock

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

TimelineMax .restart()

Recommended Posts

Hello everyone,

Im new here and got a probably a noobie question but can't handle it myself so here is it;

import com.greensock.*;
import com.greensock.easing.*;
import flash.events.MouseEvent;


var mc:myMC = new myMC();
addChild(mc);

mc.x = -200;
mc.y = stage.stageHeight/2;

var tl:TimelineMax = new TimelineMax({paused:true,yoyo:true});
tl.append(TweenMax.to(mc,2,{x:stage.stageWidth+200,onComplete:geriSar}));
function geriSar()
{
	tl.reversed = ! tl.reversed;
	tl.resume();
}
function Basla()
{
	tl.play();
}

baslat.addEventListener(MouseEvent.CLICK, animasyonBaslat);
function animasyonBaslat(e:MouseEvent)
{
	Basla();
}
durdur.addEventListener(MouseEvent.CLICK, animasyonDurdur);
function animasyonDurdur(e:MouseEvent)
{
	tl.pause();
}
yeniden.addEventListener(MouseEvent.CLICK, animasyonYenidenBaslat);
function animasyonYenidenBaslat(e:MouseEvent)
{
	tl.restart();
} 

 I'm having trouble with this last MouseEvent. tl.restart doesnt work there and i don't get it why ? 

Thx for advise.

 

Also i check other post's about this but didn't see soo :)

Link to comment
Share on other sites

i found it tho :) 

tl.gotoAndPlay(0);

this can deal with it :)

Link to comment
Share on other sites

hmm, that's very strange. From just looking at your code I do not know why there is a problem.

If you want to zip your FLA and attach it to this post (use the "more reply options" button) I will look at it.

Just be sure that the fla doesn't have a lot of extra code or assets that aren't related to the problem. The code you have above seems like the perfect amount.

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.
×