1 Reply Latest reply on Oct 2, 2010 3:27 PM by aditi_bk

    Change tween properties outside constructor in Tween class

    aditi_bk

      Hi,

       

      Am trying to use the Tween class to scale and move a movieclip. Now the movieclip is within the loader, so I need the motion to be controlled by the percentage loaded. Now the code to move the movieclip to its final position is:

       

      var xscaletween:Tween = new Tween(mstone, "_xscale", Regular.easeOut, mstone._xscale, 220, 6, true);

      var yscaletween:Tween = new Tween(mstone, "_yscale", Regular.easeOut, mstone._yscale, 220, 6, true);


      var xmovetween:Tween = new Tween(mstone, "_x", Regular.easeOut, 406, 130, 6, true);

      var ymovetween:Tween = new Tween(mstone, "_y", Regular.easeOut, 144, 30, 6, true);

       

      But this is the final location, I want to be able to change the properties of xscaletween, yscaletween, xmovetween and ymovetween as per percentage loaded. As in, within this final boundary limit of the tween, I want, for example, xscaletween, to scale only till 140 till percentage hits 50. Is this possible?? If not is there a workaround??

       

      Or do I have to use new tweens within each percentage limit?

       

      Any help will be greatly appreciated. This is my first time using the tween class, ever since Kglad suggested it regarding a previous problem, so excuse any ignorance.

        • 1. Re: Change tween properties outside constructor in Tween class
          aditi_bk Level 1

          aditi_bk wrote:

           

          Hi,

           

          Am trying to use the Tween class to scale and move a movieclip. Now the movieclip is within the loader, so I need the motion to be controlled by the percentage loaded. Now the code to move the movieclip to its final position is:

           

           

          var xscaletween:Tween = new Tween(mstone, "_xscale", Regular.easeOut, mstone._xscale, 220, 6, true);

          var yscaletween:Tween = new Tween(mstone, "_yscale", Regular.easeOut, mstone._yscale, 220, 6, true);


          var xmovetween:Tween = new Tween(mstone, "_x", Regular.easeOut, 406, 130, 6, true);

          var ymovetween:Tween = new Tween(mstone, "_y", Regular.easeOut, 144, 30, 6, true);

           

           

          But this is the final location, I want to be able to change the properties of xscaletween, yscaletween, xmovetween and ymovetween as per percentage loaded. As in, within this final boundary limit of the tween, I want, for example, xscaletween, to scale only till 140 till percentage hits 50. Is this possible?? If not is there a workaround??

           

          Ok I figured out the answer. Just need to perfect it a little. I changed the code to:

           

          var xscaletween:Tween = new Tween(mstone, "_xscale", Regular.easeOut, mstone._xscale, prcnt+140, 10, true);

          var yscaletween:Tween = new Tween(mstone, "_yscale", Regular.easeOut, mstone._yscale, prcnt+140, 10, true);


          var xmovetween:Tween = new Tween(mstone, "_x", Regular.easeOut, mstone._x, 130, 10, true);

          var ymovetween:Tween = new Tween(mstone, "_y", Regular.easeOut, mstone._y, 30, 10, true);

           

          Scales as per the amount loaded. If there is a better way, or there are any questions, do let me know