【发布时间】:2011-06-25 12:54:41
【问题描述】:
我无法在函数中添加补间动画。我的代码在 CS4 中完美运行(但不幸的是,闪存 CS4 一直挂在我的 PC 上。无论谁在 CS5 中,动作在函数外都可以正常工作,但是当我把它放在函数中时,它的行为很奇怪?我必须提到我不是专业人士闪现并为我糟糕的英语感到抱歉。
我有一个矩形形状转换为符号,我将它命名为 s1 这是没有功能的代码:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.motion.AnimatorFactory;
import fl.motion.MotionBase;
import flash.filters.*;
import flash.geom.Point;
import fl.motion.Motion;
import flash.display.DisplayObject;
var __motion_UIL1:MotionBase;
if(__motion_UIL1 == null)
{
import fl.motion.Motion;
__motion_UIL1 = new Motion();
__motion_UIL1.duration = 15;
//__motion_UIL1.overrideTargetTransform();
__motion_UIL1.addPropertyArray("x", [-280,-260,-240,-220,-200,-180,-160,-140,-120,-100,-80,-60,-40,-20,0]);
__motion_UIL1.addPropertyArray("y", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);
__motion_UIL1.addPropertyArray("scaleX", [1.000000]);
__motion_UIL1.addPropertyArray("scaleY", [1.000000]);
__motion_UIL1.addPropertyArray("skewX", [0]);
__motion_UIL1.addPropertyArray("skewY", [0]);
__motion_UIL1.addPropertyArray("rotationConcat", [0]);
__motion_UIL1.addPropertyArray("blendMode", ["normal"]);
__motion_UIL1.initFilters(["flash.filters.BlurFilter"], [0], -1, -1);
__motion_UIL1.addFilterPropertyArray(0, "blurX", [200,185.714,171.429,157.143,142.857,128.571,114.286,100,85.7143,71.4286,57.1429,42.8572,28.5715,14.2857,0], -1, -1);
__motion_UIL1.addFilterPropertyArray(0, "blurY", [0], -1, -1);
__motion_UIL1.addFilterPropertyArray(0, "quality", [BitmapFilterQuality.LOW], -1, -1);
var __animFactory_UIL1:AnimatorFactory = new AnimatorFactory(__motion_UIL1);
__animFactory_UIL1.transformationPoint = new Point(0.500000, 0.500000);
__animFactory_UIL1.addTarget(s1, 1);
}
当我将补间动画放入函数中时: (我有一个矩形形状转换为我命名为 s1 的符号)
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.motion.AnimatorFactory;
import fl.motion.MotionBase;
import flash.filters.*;
import flash.geom.Point;
import fl.motion.Motion;
import flash.display.DisplayObject;
function b1(UILx:DisplayObject)
{
var __motion_UIL1:MotionBase;
if(__motion_UIL1 == null)
{
import fl.motion.Motion;
__motion_UIL1 = new Motion();
__motion_UIL1.duration = 15;
//__motion_UIL1.overrideTargetTransform();
__motion_UIL1.addPropertyArray("x", [-280,-260,-240,-220,-200,-180,-160,-140,-120,-100,-80,-60,-40,-20,0]);
__motion_UIL1.addPropertyArray("y", [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);
__motion_UIL1.addPropertyArray("scaleX", [1.000000]);
__motion_UIL1.addPropertyArray("scaleY", [1.000000]);
__motion_UIL1.addPropertyArray("skewX", [0]);
__motion_UIL1.addPropertyArray("skewY", [0]);
__motion_UIL1.addPropertyArray("rotationConcat", [0]);
__motion_UIL1.addPropertyArray("blendMode", ["normal"]);
__motion_UIL1.initFilters(["flash.filters.BlurFilter"], [0], -1, -1);
__motion_UIL1.addFilterPropertyArray(0, "blurX", [200,185.714,171.429,157.143,142.857,128.571,114.286,100,85.7143,71.4286,57.1429,42.8572,28.5715,14.2857,0], -1, -1);
__motion_UIL1.addFilterPropertyArray(0, "blurY", [0], -1, -1);
__motion_UIL1.addFilterPropertyArray(0, "quality", [BitmapFilterQuality.LOW], -1, -1);
var __animFactory_UIL1:AnimatorFactory = new AnimatorFactory(__motion_UIL1);
__animFactory_UIL1.transformationPoint = new Point(0.500000, 0.500000);
__animFactory_UIL1.addTarget(UILx, 1);
}
}
b1(s1);
现在这适用于 CS4,但不适用于 CS5。 请帮帮我
【问题讨论】:
-
除了看起来像小火车残骸的代码之外,这似乎可以编译并作为时间线脚本正常工作。你能更具体地解决这个问题吗?你有错误吗?
-
没有。完全没有错误。但是第一个代码模糊并将我的 s1 符号在屏幕上移动 15 帧,第二个代码在不移动 1 帧的情况下进行模糊(没有模糊或移动动画)。
标签: flash actionscript-3 flash-cs4 flash-cs5