4 Replies Latest reply on May 19, 2007 11:16 AM by zibber

    scaling using matrix

    zibber Level 1
      Hi can anyone help me with this small but annoying problem please?:)

      I have the script below on main timeline frame.

      scale_up.onRelease = function() {
      var scaleUp:Matrix = new Matrix( 1.2,0,0,1.2, bubbleInstance._x, bubbleInstance._y );
      bubbleInstance.transform.matrix = scaleUp;

      };

      Now all i would like this to do is when click is to scale the target clip a small amount. This works for one click but if i click again nothing happens. Can anyone point me in right direction please
        • 1. scaling using matrix
          Jamesabth Level 1
          This is because you are scaling it up at a constant value - you need to take the current size of the movie and add to it. The second time you release the button it still scales up from the origional value.
          • 2. Re: scaling using matrix
            zibber Level 1
            thanks james

            but how can i make the increments quite small? Whatever i try to do really makes big jumps int he scale i.e below:

            scale_up.onRelease = function() {

            var scaleUp:Matrix = new Matrix(bubbleInstance._xscale + 0.2, 0,0, bubbleInstance._yscale + 0.2 , bubbleInstance._x, bubbleInstance._y );
            bubbleInstance.transform.matrix = scaleUp;

            };

            many thnaks in advance
            • 3. scaling using matrix
              Jamesabth Level 1
              The code below should work.

              It uses the count variable to count how many times it has been resized previously. If you have a scale_down button then you should add "count --" to it so that the count decreases. The 0.2 is multiplied by the value of count and is added to one, so the first time the button is released the result is 1 + 0.2 x 1 = 1.2 ,and the second time it is 1 + 0.2 x 2 = 1.4 (104% of the origional size).

              PS. If you resize the movie clip instance then when you press the size up it will still size up from the movie clip's actual size - so it will jump down in size when you first click the size up button. It it 'good practice' to resize the content of a movie clip and not its instance just in case a situation like this occurs (just to let you know in case this happens to if you decide that the movie clip needs to be bigger).

              Always glad to help
              James
              • 4. Re: scaling using matrix
                zibber Level 1
                Thanks very much James

                Really appreciate it