0 Replies Latest reply: Mar 21, 2011 11:48 AM by barpos RSS

    AS3 motion tween not working

    barpos Community Member

      Hi,

       

      No matter how much I try, it just won't work even though it appears to be straightforward to apply.  I even tried "new MotionBase()" instead of "new Motion()", but to no avail.

       

      import flash.display.MovieClip;
      import flash.display.Bitmap;
      import flash.display.BitmapData;
      import fl.motion.AnimatorFactory;
      import fl.motion.MotionBase;
      import fl.motion.Motion;

       

          var __motion_myTween:MotionBase;

       

          if (__motion_myTween == null)
          {
              __motion_myTween = new Motion();
              __motion_myTween.duration = 24;

       

              // Call overrideTargetTransform to prevent the scale, skew,
              // or rotation values from being made relative to the target
              // object's original transform.
              // __motion_myTween.overrideTargetTransform();

       

              // The following calls to addPropertyArray assign data values
              // for each tweened property. There is one value in the Array
              // for every frame in the tween, or fewer if the last value
              // remains the same for the rest of the frames.
              __motion_myTween.addPropertyArray("x", [0,13.7126,34.7956,61.0896,91.4569,123.101,152.394,178.196,201.373,228.094,252.042,251.22 4,227.291,197.623,174.757,165.781,186.499,210.704,233.778,262.517,293.935,325.339,354.883, 384.35]);
              __motion_myTween.addPropertyArray("y", [0,28.5194,52.287,70.1238,79.0858,76.9051,64.7643,46.1132,24.2673,7.51918,-13.2186,-42.91 47,-63.5505,-64.9093,-43.0839,-13.4969,10.362,31.0706,52.9098,66.2217,71.2857,67.9391,56.0 555,44.25]);
              __motion_myTween.addPropertyArray("scaleX", [1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.00000 0,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.00000 0,1.000000,1.000000,1.000000,1.000000]);
              __motion_myTween.addPropertyArray("scaleY", [1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.00000 0,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.000000,1.00000 0,1.000000,1.000000,1.000000,1.000000]);
              __motion_myTween.addPropertyArray("skewX", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);
              __motion_myTween.addPropertyArray("skewY", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);
              __motion_myTween.addPropertyArray("rotationConcat", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);
              __motion_myTween.addPropertyArray("blendMode", ["normal"]);
              __motion_myTween.addPropertyArray("cacheAsBitmap", [false]);

       

              // Create an AnimatorFactory instance, which will manage;
              // targets for its corresponding Motion.
              var myTween:AnimatorFactory = new AnimatorFactory(__motion_myTween);
              myTween.transformationPoint = new Point(0.499882,0.500000);

       

              // Call the addTarget function on the AnimatorFactory
              // instance to target a DisplayObject with this Motion.
              // The second parameter is the number of times the animation
              // will play - the default value of 0 means it will loop.
              myTween.addTarget(myBigMonkey, 0);   // myBigMonkey is displayed on Flash stage
              trace(String(myBigMonkey));   // object MovieClip
          }

       

      Any ideas?

       

      Regards,

       

      Ron