r11290
04-24-2009, 11:11 PM
This is a "game i have been making for my a level ict but im having a problem getting the buttons to work, on the game screen the first question works fine, when you click the correct not you are transported to the next question but on the second question when you select any of the buttons you are always transported to the compleatly wrong slide (the slide you would be moved to if you selected the wrong answer on the first question). Pleas could you help me find out what is wrong with my coding?
here is the code for the fist question:
stop();
C_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
F_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
G_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
A_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
B_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
D_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
E_mid_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
function wrongnoteClicked(e:MouseEvent):void{
switch(e.currentTarget.name){
case F_btn.name:
gotoAndStop(51);
break;
case G_btn.name:
gotoAndStop(51);
break;
case A_btn.name:
gotoAndStop(51);
break;
case B_btn.name:
gotoAndStop(51);
break;
case E_mid_btn.name:
gotoAndStop(51);
break;
case D_btn.name:
gotoAndStop(51);
break;
case C_btn.name:
gotoAndStop(21);
break;
}
}
stop();
here is the code for the second question
stop();
C_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
F_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
G_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
A_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
B_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
D_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
E_mid_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
function wrongnotegClicked(e:MouseEvent):void{
switch(e.currentTarget.name){
case F_btn.name:
gotoAndStop(61);
break;
case G_btn.name:
gotoAndStop(25);
break;
case A_btn.name:
gotoAndStop(61);
break;
case B_btn.name:
gotoAndStop(61);
break;
case E_mid_btn.name:
gotoAndStop(61);
break;
case D_btn.name:
gotoAndStop(61);
break;
case C_btn.name:
gotoAndStop(61);
break;
stop();
}
}
stop();
thanks again
here is the code for the fist question:
stop();
C_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
F_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
G_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
A_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
B_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
D_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
E_mid_btn.addEventListener(MouseEvent.CLICK, wrongnoteClicked);
function wrongnoteClicked(e:MouseEvent):void{
switch(e.currentTarget.name){
case F_btn.name:
gotoAndStop(51);
break;
case G_btn.name:
gotoAndStop(51);
break;
case A_btn.name:
gotoAndStop(51);
break;
case B_btn.name:
gotoAndStop(51);
break;
case E_mid_btn.name:
gotoAndStop(51);
break;
case D_btn.name:
gotoAndStop(51);
break;
case C_btn.name:
gotoAndStop(21);
break;
}
}
stop();
here is the code for the second question
stop();
C_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
F_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
G_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
A_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
B_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
D_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
E_mid_btn.addEventListener(MouseEvent.CLICK, wrongnotegClicked);
function wrongnotegClicked(e:MouseEvent):void{
switch(e.currentTarget.name){
case F_btn.name:
gotoAndStop(61);
break;
case G_btn.name:
gotoAndStop(25);
break;
case A_btn.name:
gotoAndStop(61);
break;
case B_btn.name:
gotoAndStop(61);
break;
case E_mid_btn.name:
gotoAndStop(61);
break;
case D_btn.name:
gotoAndStop(61);
break;
case C_btn.name:
gotoAndStop(61);
break;
stop();
}
}
stop();
thanks again