2017-01-09 6 views
0

私は学生を評価するための簡単なゲームを作っています。私はActionScript 2.0に基づいてコードを構築できます。私は揚げたから、ActionScript 3.0はAndroidで使用できると聞きました。だから私は、これはそのようなものになるだろうAS3で私のActionScript 2.0コードこのコードをActionScript 2.0からActionScript 3.0に変換する方法は?

stop(); 
score=0;//skor total 
step=1;//gerakan pemain 
moveframe=4; 
number=0;//dadu 

a1.onPress=function(){ 
    number=0; 
    number=number+1; 
    score=score+1; 
    step=step+1; 
    moveframe=moveframe+1; 
    _root.player._x = _root["square"+step]._x; 
    _root.player._y = _root["square"+step]._y; 
    _root.gotoAndStop(moveframe); 
    _root.soal.gotoAndStop(step); 
    trace(step); 
} 
b1.onPress=function(){ 
    number=0; 
    number=number+1; 
    score=score+1; 
    step=step+1; 
    moveframe=moveframe+1; 
    _root.player._x = _root["square"+step]._x; 
    _root.player._y = _root["square"+step]._y; 
    _root.gotoAndStop(moveframe); 
    _root.soal.gotoAndStop(step); 
    trace(step); 
} 
c1.onPress=function(){ 
    number=0; 
    number=number+1; 
    score=score+1; 
    step=step+1; 
    moveframe=moveframe+1; 
    _root.player._x = _root["square"+step]._x; 
    _root.player._y = _root["square"+step]._y; 
    _root.gotoAndStop(moveframe); 
    _root.soal.gotoAndStop(step); 
    trace(step); 
} 
d1.onPress=function(){ 
    number=0; 
    number=number+1; 
    score=score+1; 
    step=step+1; 
    moveframe=moveframe+1; 
    _root.player._x = _root["square"+step]._x; 
    _root.player._y = _root["square"+step]._y; 
    _root.gotoAndStop(moveframe); 
    _root.soal.gotoAndStop(step); 
    trace(step); 
} 
e1.onPress=function(){ 
    number=0; 
    number=number+1; 
    score=score+1; 
    step=step+1; 
    moveframe=moveframe+1; 
    _root.player._x = _root["square"+step]._x; 
    _root.player._y = _root["square"+step]._y; 
    _root.gotoAndStop(moveframe); 
    _root.soal.gotoAndStop(step); 
    trace(step); 
} 
+0

あなたはどこにいるのですか? – halfer

+0

手で書き換えます。私が知る限り、他のオプションはありません – www0z0k

+0

私は["square" + step]を書く方法についています。 –

答えて

1

ある 、私のゲームは、Androidで再生することができます願っています:

stop(); 

var score:int = 0;//skor total 
var step:int = 1;//gerakan pemain 
var moveframe:int = 4; 
// this one is useless: number=0;//dadu 

for each (var aButton:InteractiveObject in [a1,b1,c1,d1,e1]) 
{ 
    aButton.addEventListener(MouseEvent.MOUSE_DOWN, onButton); 
} 

function onButton(e:MouseEvent):void 
{ 
    step++; 
    score++; 
    moveframe++; 

    root.player.x = root.getChildByName("square"+step).x; 
    root.player.y = root.getChildByName("square"+step).y; 

    root.gotoAndStop(moveframe); 
    root.soal.gotoAndStop(step); 

    trace(step); 
} 

あなたがより多くを行う必要があることに注意してくださいあなたのアプリがスムーズにAndroid上で実行されるようにしたい場合は、それだけです。しかし、あなた自身の楽しみのためだけにそれをやっているなら、AS3に移行すれば十分です。

関連する問題