gpt4 book ai didi

actionscript-3 - Action Script 3 .循环动画3次然后停止

转载 作者:行者123 更新时间:2023-12-04 02:11:00 25 4
gpt4 key购买 nike

我正在处理 Flash 横幅,我希望动画循环 3 次然后停止。我不知道 Action Script,但我找到了这段代码:

在第一帧我使用了这个:

_root.loops_played = 0;

if (_root.loops_played >= 3){

stop(); //*

} else {

play();

}

在最后一帧:

_root.loops_played += 1;

不幸的是,动画一直在循环,我得到了这个错误:

Scene 1, Layer 'actions', Frame 1, Line 1   1120: Access of undefined property _root.
Scene 1, Layer 'actions', Frame 1, Line 3 1120: Access of undefined property _root.
Scene 1, Layer 'actions', Frame 175, Line 1 1120: Access of undefined property _root.
Scene 1, Layer 'actions', Frame 175, Line 1 1120: Access of undefined property _root.

有人能帮忙吗?

最佳答案

_root 在 AS3 中不存在。这是一个 AS2 的东西。

不过,要让您当前的逻辑运行,请使用 this 而不是 _root

这是一些代码,对您提供的内容没有太大改动:

第一帧:

if(!this.loops_played) this.loops_played = 1;

if(this.loops_played >= 3) stop(); else play();

最后一帧:

this.loops_played++;

关于actionscript-3 - Action Script 3 .循环动画3次然后停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17692812/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com