Jump to content
GreenSock

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

[SOLVED BY MAJ] TimeLineMax And Zero Duration Again...

Recommended Posts

Hi everyone,

 

I'm trying to do a simple thing:

-Create a timelinemax instance which will play later a the end of the code

-Insert some tweens (just one for the exemple here), these tweens can be zero duration ones!

-Do some operations relative to my project

-Then playstart the timelinemax instance and listen to the COMPLETE event

 

import com.greensock.TweenMax;
import com.greensock.events.TweenEvent;
import com.greensock.TimelineMax;
import flash.display.Sprite;

var round:Sprite=new Sprite();
round.graphics.lineStyle(0.1);
round.graphics.drawCircle(0,0,25);
addChild(round);

var timeLine:TimelineMax = new TimelineMax({paused:true});
timeLine.insert(new TweenMax(round, 2, {x:stage.stageWidth,y:stage.stageHeight}));
//
//Do some stuffs related to my project...
//
timeLine.play();
timeLine.addEventListener(TweenEvent.COMPLETE, completeHandler);

function completeHandler(evt:TweenEvent)
{
trace("complete");
}

 

With the code above, no problems, everything works fine

But with a zero duration tween...

import com.greensock.TweenMax;
import com.greensock.events.TweenEvent;
import com.greensock.TimelineMax;
import flash.display.Sprite;

var round:Sprite=new Sprite();
round.graphics.lineStyle(0.1);
round.graphics.drawCircle(0,0,25);
addChild(round);

var timeLine:TimelineMax = new TimelineMax({paused:true});
timeLine.insert(new TweenMax(round, 0, {x:stage.stageWidth,y:stage.stageHeight}));
//
//Do some stuffs related to my project
//
timeLine.play();
timeLine.addEventListener(TweenEvent.COMPLETE, completeHandler);

function completeHandler(evt:TweenEvent)
{
trace("complete");
}

 

With this code the round is reaching its destination but no event is catched, I can't enter in the completeHandler function

 

I read around here about the immediateRender property, but when I specify it false on my tween, that one just never starts, even if I use the play() method on the timelinemax instance...

 

How can I do? :-o

Link to comment
Share on other sites

Ah yes, zero-duration tweens and timelines can be tricky because they aren't really "tweens" since there's no time that elapses, but thanks for pointing out the issue. It should be resolved in the latest version (posted a few minutes ago).

Link to comment
Share on other sites

Yeah right on time!

That works perfectly fine now

Thanks dude

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