从flash导出动画数据?

时间:2011-03-22 19:53:31

标签: flash animation

从Pro Adob​​e Flash可以导出动画的数据吗?类似于序列中各个图像的x和y坐标和旋转值。

1 个答案:

答案 0 :(得分:3)

您可以右键单击运动补间实例或时间轴中的补间,然后选择将动作复制为ActionScript 3.0

Copy Motion as ActionScript 3.0

然后你会在剪贴板中找到这样的东西:

import fl.motion.AnimatorFactory;
import fl.motion.MotionBase;
import fl.motion.Motion;
import flash.filters.*;
import flash.geom.Point;
var __motion_Symbol1_2:MotionBase;
if(__motion_Symbol1_2 == null) {
    __motion_Symbol1_2 = new Motion();
    __motion_Symbol1_2.duration = 24;

    // Call overrideTargetTransform to prevent the scale, skew,
    // or rotation values from being made relative to the target
    // object's original transform.
    // __motion_Symbol1_2.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_Symbol1_2.addPropertyArray("x", [0]);
    __motion_Symbol1_2.addPropertyArray("y", [0]);
    __motion_Symbol1_2.addPropertyArray("scaleX", [1.000000]);
    __motion_Symbol1_2.addPropertyArray("scaleY", [1.000000]);
    __motion_Symbol1_2.addPropertyArray("skewX", [0]);
    __motion_Symbol1_2.addPropertyArray("skewY", [0]);
    __motion_Symbol1_2.addPropertyArray("rotationConcat", [0]);
    __motion_Symbol1_2.addPropertyArray("cacheAsBitmap", [false]);

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

    // 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.
    // __animFactory_Symbol1_2.addTarget(<instance name goes here>, 0);
}