Tweener on start AS3

253 Views Asked by At
for (var i:int=cardCount; i < numberOfCardsToDispatch;i++){

            Tweener.addTween(packArray[i], {x:packPosX - dealXPos, time:.4, delay:dealDelay, transition:"easeOutExpo", onStart:function(){packArray[i].visible = true;}});


        }

I'm looping through my array, packArray[i] refers to a sprite. I want it so that as soon as the Tween starts the sprite is visible.

The above code does not tween the sprite, just freezes it, as soon as I take onStart out, it works. Any ideas where I'm going wrong?

1

There are 1 best solutions below

0
Florent On BEST ANSWER

Tweener is no longer maintain. You should try TweenMax.

Tweener was maintained from june 2005 to june 2009. While it still works, it's not being maintained anymore [...]

With Tweener:

Tweener.addTween(packArray[i], {
    time: .4,
    delay: dealDelay,
    x: packPosX - dealXPos,
    ease: "easeOutExpo",
    onStart: function():void { this.visible = true; } // You should use this
});

With TweenMax:

TweenMax.to(packArray[i], .4, {
    delay: dealDelay,
    x: packPosX - dealXPos, // Or "-100" if you want to move to the left to 100px
    ease: Expo.easeOut,
    onStart: function():void { packArray[i].visible = true; }
});