Search code examples
flashactionscript-3tween

tweening two properties in Flash


I use this to tween many parameters

        var tween:Tween = new Tween(imageObject, "x", Regular.easeIn, imageObject.x,nextImageObject.x-imageStep, 1, true);
        var tween1:Tween = new Tween(imageObject, "rotationY" , Regular.easeIn, imageObject.rotationY, rotationAngle,1, true);
        var tween2:Tween = new Tween(imageObject, "z" , Regular.easeIn, imageObject.z, newWidth,1, true);
        var tween3:Tween = new Tween(imageObject, "height", Regular.easeIn, imageObject.height, imageHeightAtEgde, 1, true);
        var tween4:Tween = new Tween(imageObject, "width", Regular.easeIn, imageObject.width,newWidth,1,true);

I want run this tweens together. Is there any "clean" methods to do this without many tweens?


Solution

  • First of all, everyone in the community suggests shying away from the default ActionScript Tweening engine. That's why Adobe basically stopped improving it. There are way better tweening engines.

    I would suggest looking into TweenLite. It has a lot of capabilities and instead of creating multiple tweens for parameters like in your example, you pass in tweening objects with parameters you want to tween, like this:

    TweenLite.to(imageObject, 1, {x: nextImageObject.x-imageStep, rotationY: rotationAngle, z: newWidth, width: newWidth, height:imageHeightAtEgde});