我设计了一个简单的游戏,在老鼠使用actionscript 3.我不知道如何更改actionscript 2的代码到actionscript 3,请帮助我。有人能告诉我如何将ActionScript 2转换为actionscript3吗?
有人能帮我告诉我如何将ActionScript 2转换为actionscript3吗?
jumlah = 0;
waktu_muncul = 0;
function buat_tikus()
{
nomor = random(3)+1;
tikus=attachMovie("tikus","tikus",2{_x:_root["lingkaran"+nomor]._x,_y:_root["lingkaran"+nomor]._y});
tikus.onEnterFrame = function()
{
waktu_muncul++;
if (waktu_muncul == 0)
{
this.gotoAndStop(4);
}
if (waktu_muncul == 20)
{
removeMovieClip(this);
buat_tikus();
waktu_muncul = 2;
}
tikus.onPress = function()
{
sound1 = new Sound();
sound1.attachSound("Suaratikus");
sound1.start(0,1);
var tikus:MovieClip;
if (jumlah == 90)
{
stop();
nextFrame();
}
if (this._currentframe == 1)
{
jumlah += 10;
this.gotoAndPlay(2);
}
};
};
}
onEnterFrame = function()
{
fps++;
if (fps == 20)
{
timer_txt--;
fps=0
if (timer_txt==0)
{
stop();
gotoAndStop(6);
}
}
palu.swapDepths(_root.getNextHighestDepth());
palu._x = _xmouse;
palu._y = _ymouse;
};
onMouseDown = function()
{
if (palu._currentframe == 1)
{
palu.gotoAndPlay(2);
}
};
buat_tikus();
var fps : Number = 0;
var timer_txt : Number = 20;
没有将AS2转换为AS3,它们是2种不同的语言。 – BotMaster
AS2和AS3的语法类似,但是AS2数据类型与Flash的直接耦合已被删除。有许多参考资料可以帮助迁移过程; http://www.adobe.com/devnet/flash/articles/first_as3_application.html和http://cis.msjc.edu/courses/Internet_Authoring/CSIS119A/Resources/langref/migration.html(不知道在哪里(如果)该文档已经存在于Adobe网站上)是一个开始的好地方。 – SushiHangover
我认为这段代码是'AS1'。在'AS2'和'AS3'中,** Flash Player 5 **中的'random'全局函数被移除,以支持'Math'类的'random'方法。请从头开始构建应用程序,因为'AS1'是一种古老的语言,与AS3完全不同(完全不同)。 – ElChiniNet