Jump to content
Search Community

LePiou

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by LePiou

  1. Hi all,

     

    I started routinely using Tweenlite.to() static method instead of a Timer by setting a fake target (like 'this') and just putting a onComplete on the tweenvars object.

    I dunno if I should, what about the efficiency of that trick?

     

      TweenLite.to(this,2,{onComplete:myFunc});
    function myFunc()
    {
    //My instructions...
    }
    

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

  3. 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?

×
×
  • Create New...