我使用的ide是flash cs3。 as2 swf包含使用mx过渡的补间代码。 当我删除这个补间代码并在enterframe上硬编码它似乎没有问题。 afaik avm2应该完全支持as2和as1代码。所以当我在as2 swf编码一个简单的补间时,我无法理解为什么会出现这种差异。 我曾在动作论坛上发帖,希望能够对这个问题有所了解。附上一个非常简单的附件来说明问题 http://www.actionscript.org/forums/showthread.php3?t=229901 p.s 2 swf互不相互影响。 as2文件中的代码
//~~~~~~~~~~~~~~~~~~~~~~~ with tween class
import mx.transitions.*;
import mx.transitions.easing.*;
function tweenMe(mc, target) {
myTween = new Tween(mc, "_x", Regular.easeOut, mc._x, target, 2, true);
}
tweenMe(mc, 700);
//~~~~~~~~~~~~~~~~~~~~~~~ Simple Hard coded control
/*this.onEnterFrame = function() {
mc._x += (700-mc._x)/10;
};
*/
答案 0 :(得分:0)
我不认为您在使用AS3 _x
类时可以使用Tween
。您的Actionscript-2 swf将被视为AVM1Movie
个对象(DisplayObject
的后代)。在ActionScript-3中,DisplayObject
没有属性_x
。所以尝试使用:
function tweenMe(mc, target) {
myTween = new Tween(mc, "x", Regular.easeOut, mc.x, target, 2, true);
}
tweenMe(mc, 700);
ActionScript-3文档说明了这一点:The AVM1Movie object can use methods and properties inherited from the DisplayObject class (such as x, y, width, and so on). However, no interoperability (such as calling methods or using parameters) between the AVM1Movie object and AVM2 objects is allowed.
答案 1 :(得分:0)
我遇到的关于这个问题的唯一令人信服的答案就是这个
http://www.actionscript.org/forums/showpost.php3?p=968206&postcount=9
根据情况,可能更容易重新编码故障代码位。