加载到 AS3 swf 时 AS2 swf 的奇怪行为会破坏,任何人都可以解释这是为什么吗?

发布于 2024-08-20 07:25:44 字数 781 浏览 1 评论 0原文

我使用的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光匆匆的小流年 2024-08-27 07:25:44

我认为在使用 AS3 Tween 类时不能使用 _x 。您的 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 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 AS3 Tween Class. Your Actionscript-2 swf will be treated as AVM1Movie object (descendants of DisplayObject). And in ActionScript-3, DisplayObject doesn't have property _x. So Try using:

function tweenMe(mc, target) {
myTween = new Tween(mc, "x", Regular.easeOut, mc.x, target, 2, true);
}
tweenMe(mc, 700);

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.

信愁 2024-08-27 07:25:44

关于这个问题我遇到的唯一令人信服的答案是这个

http://www.actionscript.org/forums/ showpost.php3?p=968206&postcount=9

根据具体情况,重新编码故障代码位可能会更容易。

the only convincing answer i had come across regarding this problem was this

http://www.actionscript.org/forums/showpost.php3?p=968206&postcount=9

depending upon situation it might be easier to just re-code the trouble code bit.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文