Jump to content
GreenSock

kipp last won the day on October 3 2012

kipp had the most liked content!

kipp

Members
  • Posts

    4
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by kipp

  1. I think what's happening is that your function calls are forgetting what 'this' refers to. Depending on where your function gets called, it can get goofed up easily. Luckily TweenLite has a way to fix the problem. Try adding onUpdateScope and onCompleteScope properties to your tweens like so:

     

    TweenMax.to(this, .5, {hires_alpha:0, overwrite:2, onUpdate:reDrawMain, onComplete:this.check_hires, onCompleteScope:this});
    

     

    Hopefully that does the trick!

    -Kipp

    • Like 2
  2. Ah, that's making more sense now. Thanks for taking the time to explain it to me. :)

     

    So I play through my timeline and it stops, then later when I change the repeat to 1, that effectively makes the totalProgress = .5. Now if I resume at this point, shouldn't my timeline progress backwards until it gets to 0? If I change the following lines in the previously posted code, the animation jumps directly to alpha = 0.

     

    Am I still missing something?

     

    public function changeRepeat():void {
    _ani.repeat = 1; // _ani.totalProgress = .5 as a result of this.
    _ani.yoyo = true;
    _ani.resume(); // Should fade from current alpha to 0
    }
    

     

    Thanks for the help!

    -Kipp

  3. Hi Jack,

    I just came across an issue when setting repeat or yoyo after a timeline has already played once. This is using the most recent version of the tweening classes (11.104). It appears that changing the repeat value won't interfere with calling reverse(), but it won't actually repeat no matter what you set the value to. Setting yoyo to true prevents reverse() from working at all. I've attached an example below:

     

    package{
    
    import flash.display.Sprite;
    import com.greensock.*;
    
    public class TweenTest extends Sprite {
    
    protected var _ani:TimelineMax = new TimelineMax();
    
    public function TweenTest():void {
    	var s:Sprite = addChild(new Sprite()) as Sprite;
    	s.graphics.beginFill(0xCC0000);
    	s.graphics.drawCircle(0,0,40);
    	s.x = stage.stageWidth * .5;
    	s.y = stage.stageHeight * .5;
    
    	_ani.insert(TweenMax.from(s, 2, { alpha:0 }));
    
    	TweenMax.delayedCall(4, changeRepeat);
    }
    
    public function changeRepeat():void {
    	trace("Animation should now alpha out and then alpha in again, but appears to be tired of tweening.")
    	_ani.repeat = 1;
    	_ani.yoyo = true;
    	_ani.reverse();
    }
    }
    }
    

     

    Any ideas? Thanks a bundle!

    -Kipp

×