Jump to content
GreenSock

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

Last Tween Declares Complete First?

Recommended Posts

Hi all,

 

this is my first post here so a big thanks to Jake for his great classes that helps me everyday

 

I have a interrogation though.. here is a simple code to illustrate it

 

Main.as:

package 
{

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


public class Main extends MovieClip
{


	public function Main()
	{
	var square:Sprite = new Sprite();
	square.name="Square";
	square.graphics.beginFill(0);
	square.graphics.drawRect(0,0,50,50);

	var circle:Sprite = new Sprite();
	circle.name="Circle";
	circle.graphics.beginFill(0);
	circle.graphics.drawCircle(0,0,25);

	addChild(square);
	addChild(circle);

	var squareTween:TweenMax = new TweenMax(square, 2, {x:100,y:100});
	var circleTween:TweenMax = new TweenMax(circle, 2, {x:100,y:100});

	squareTween.addEventListener(TweenEvent.COMPLETE, traceComplete);
	circleTween.addEventListener(TweenEvent.COMPLETE, traceComplete);

		function traceComplete(evt:TweenEvent)
		{
                       trace(evt.currentTarget.target.name+" has completed his tweening");
		}

	}
}

}

 

So i created two sprite and two tweens with same duration and properties, and then add listeners to them to trace who's completing first.

Since I launch the squareTween first I assumed it would be the first to dispatch a Complete event... well it's not

 

trace window:

Rond has completed his tweening
Carre has completed his tweening

 

In fact it seems to be the LAST tween you declared that Complete first...

I even tried with the immediateRender thing set to true but it doesnt change anything, still the last tween who complete first.

I'm little bit confused :? Can someone enlighten me about this?

Link to comment
Share on other sites

It sounds like maybe you have a very old version of the tweening classes. What version are you using? I'd definitely recommend updating to the latest.

Link to comment
Share on other sites

Oh gosh you're right, I was sure I was using the latest one, I should have unfortunately mixed up some olds directories :oops:

 

Well... thanks again ;)

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