Why buttons inside movieclip isn't working (actionscript 2)

193 views Asked by At

I had a problem using buttons inside moviclip

This my scenario I take a button in a frame inside movieclip,in next frame i take b button inside movieclip and its continues until z

When the a button clicked,then the frame going to next frame and move some movieclip in root,then b button clicked,then the frame going to next frame and also move some movieclip in root and its continues until y

The problem is when a button clicked (working) but the next button (b,c,d....) isn't working

this is my script

stop();
nilai=0;//skor total
langkah=1;//gerakan pemain
angka=0;//dadu


jawabana.a1.onPress=function(){ //first button inside first frame of movieclip
 angka=0;
 angka=angka+1;
 nilai=nilai+1;
 langkah=langkah+1;
 _root.pemain._x = _root["kotak"+langkah]._x;
 _root.pemain._y = _root["kotak"+langkah]._y;
 _root.jawabana.gotoAndStop(langkah);
 _root.soal.gotoAndStop(langkah);
 trace(langkah);
}
jawabana.a2.onPress=function(){ //button on second frame of movieclip
 angka=0;
 angka=angka+1;
 nilai=nilai+1;
 langkah=langkah+1;
 _root.pemain._x = _root["kotak"+langkah]._x;
 _root.pemain._y = _root["kotak"+langkah]._y;
 _root.jawabana.gotoAndStop(langkah);
 _root.soal.gotoAndStop(langkah);
 trace(langkah);
}

a button is a1 b button is a2 c button is a3

Pleae help Thanks

1

There are 1 answers

4
alshayal On

I guess you wrote all the event listeners of all the buttons on the first frame.

If this guess is true, there will be a conflict that the actions will not be able to communicate to the buttons on the coming frames as those buttons are not loaded yet.

So you have to write each button event listener on its own frame.