加载到 AS3 swf 时 AS2 swf 的奇怪行为会破坏,任何人都可以解释这是为什么吗?
我使用的IDE是flash cs3。 as2 swf 包含使用 mx 转换的补间代码。 当我删除这个补间代码并在 EnterFrame 上对其进行硬编码时,似乎没有问题。 afaik avm2 应该完全支持 as2 和 as1 代码。所以我无法理解为什么在 as2 swf 中编码简单的补间时会出现这种差异。 我在 ActionScript 论坛上发了一篇帖子,希望能对这个问题有所了解。有一个非常简单的附件说明了问题 http://www.actionscript.org/forums/showthread.php3?t= 229901 ps 这两个 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;
};
*/
The ide i am using is flash cs3. the as2 swf contains a tween code using mx transitions.
when i remove this tween code and hard code it on the enterframe there seems to be no problem.
afaik avm2 should fully supports the as2 and as1 code. so i am unable to understand why this disparity when coding a simple tween in as2 swf.
i had made a post in the actionscript forums hoping to gain some light on the issue. with a very simple attachment illustrating the issue
http://www.actionscript.org/forums/showthread.php3?t=229901
p.s the 2 swf do not interact with each other.
the code in as2 file
//~~~~~~~~~~~~~~~~~~~~~~~ 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;
};
*/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为在使用 AS3
Tween
类时不能使用_x
。您的 Actionscript-2 swf 将被视为AVM1Movie
对象(DisplayObject
的后代)。在 ActionScript-3 中,DisplayObject
没有属性_x
。所以尝试使用:ActionScript-3 Documentation says this:
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.
I don't think you can use
_x
while using AS3Tween
Class. Your Actionscript-2 swf will be treated asAVM1Movie
object (descendants ofDisplayObject
). And in ActionScript-3,DisplayObject
doesn't have property_x
. So Try using:ActionScript-3 Documentation says this:
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.
关于这个问题我遇到的唯一令人信服的答案是这个
根据具体情况,重新编码故障代码位可能会更容易。
the only convincing answer i had come across regarding this problem was this
depending upon situation it might be easier to just re-code the trouble code bit.