Hello,
I have such code:
var tlIn:TimelineMax=new TimelineMax;
var tlOut:TimelineMax=new TimelineMax;
var spr:Sprite=new Sprite;
public function show():void
{
tlIn.append(TweenMax.to(spr,1,{autoAlpha:1}));
}
public function hide():void
{
tlOut.append(TweenMax.to(spr,1,{autoAlpha:0}));
}
public function animateIn():TweenCore
{
tlIn=new TimelineMax;
tlIn.append(TweenMax.delayedCall(0,show));
return tlIn;
}
public function animateOut():TweenCore
{
tlOut=new TimelineMax;
tlOut.append(TweenMax.delayedCall(0,hide));
return tlOut;
}
private function onClick(event:MouseEvent):void
{
var tal:TimelineMax=new TimelineMax
tal.append(animateOut());
tal.append(animateIn());
}
I want to put all animation into show and hide functions( to extend some base class) , but the sequence should start when animateOut/In is fired. I thought that TweenMax.delayedCall could help but it doesn't wait in queue and fires when animateOut/In function is called so tweens from show/hide function overrides each other.
Why? Shouldn't it act as normal TweenMax instance? Of course I can replace TweenMax.delayedCall with ex tlIn.append(TweenMax.to(spr,1,{autoAlpha:1})); and it will work but I want to know the logic.
thank you.