【发布时间】:2015-06-03 17:47:04
【问题描述】:
所以我有这个从 Cs6 复制的动作脚本作为“将动作复制为 AS3”。在我尝试使用鼠标事件功能控制它之前,它工作正常。那么我错过了什么?它在函数外部工作正常,但在内部根本不行。
import fl.motion.AnimatorFactory;
import fl.motion.MotionBase;
import fl.motion.Motion;
import flash.filters.*;
import flash.geom.Point;
var __motion_NewBall_7: MotionBase;
theButton.addEventListener(MouseEvent.CLICK, on_press1);
function on_press1(event: MouseEvent): void {
if (__motion_NewBall_7 == null) {
__motion_NewBall_7 = new Motion();
__motion_NewBall_7.duration = 60;
__motion_NewBall_7.addPropertyArray("x", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4.02143, -8.04286, -12.0603, -16.0857, -20.1071, -24.1246, -28.15, -35.6987, -43.2474, -50.7885, -58.3447, -65.8934, -73.4346, -80.9832, -88.5395, -96.0882, -103.637, -111.186, -118.727, -126.283, -133.824, -141.38, -148.929, -156.478, -164.026, -171.575, -179.124, -186.672, -194.221, -201.77, -209.311, -216.867, -224.416, -231.957, -239.506, -247.062, -254.611, -262.152, -269.708, -277.257, -284.805, -292.346, -299.903, -307.451, -315]);
__motion_NewBall_7.addPropertyArray("y", [0, 9.41071, 18.8214, 28.2227, 37.6429, 47.0536, 56.4549, 65.875, 75.2857, 84.6964, 94.1071, 103.518, 112.919, 122.339, 131.75, 124.157, 116.564, 108.979, 101.379, 93.7857, 86.2004, 78.6, 84.0237, 89.4474, 94.8656, 100.295, 105.718, 111.137, 116.56, 121.989, 127.413, 132.837, 138.261, 143.679, 149.108, 154.526, 159.955, 165.379, 170.803, 176.226, 181.65, 187.074, 192.497, 197.921, 203.345, 208.763, 214.192, 219.616, 225.034, 230.458, 235.887, 241.311, 246.729, 252.158, 257.582, 263.005, 268.424, 273.853, 279.276, 284.7]);
__motion_NewBall_7.addPropertyArray("scaleX", [1.000000]);
__motion_NewBall_7.addPropertyArray("scaleY", [1.000000]);
__motion_NewBall_7.addPropertyArray("skewX", [0]);
__motion_NewBall_7.addPropertyArray("skewY", [0]);
__motion_NewBall_7.addPropertyArray("rotationConcat", [0]);
__motion_NewBall_7.addPropertyArray("blendMode", ["normal"]);
__motion_NewBall_7.addPropertyArray("cacheAsBitmap", [false]);
__motion_NewBall_7.addPropertyArray("opaqueBackground", [null]);
__motion_NewBall_7.addPropertyArray("visible", [true]);
var __animFactory_NewBall_7: AnimatorFactory = new AnimatorFactory(__motion_NewBall_7);
__animFactory_NewBall_7.transformationPoint = new Point(0.500000, 0.500000);
__animFactory_NewBall_7.addTarget(myClip, 0);
}
}
【问题讨论】:
-
请详细说明“不起作用”。没发生什么事?你得到一个错误?它没有按照应有的方式制作动画?
-
我同意,请详细说明,myClip 在哪里,是否已正确添加到显示列表中?
-
表示动作没有发生。基本上它是一个在特定路径下落的球。运行 swf 时,只有当动作/动画在函数之外时它才能正常工作。但我希望只有在单击按钮后球才会落下。
-
on_press1函数真的在执行吗?
-
是的,我测试了这个功能并且它有效
标签: actionscript-3 flash