PDA

View Full Version : my switch doesn't default?


Heloed
08-08-2008, 10:48 PM
Code for pressing a button. (It isn't really a button-pressing thing, but I changed it to be simpler.

var buttonTryPress:int = 0;
function tryButton(event:MouseEvent):void {
buttonTryPress = buttonTryPress + 1;
switch(buttonTryPress){
case 1:
gametext.text = "Hey look a button.";
break;
case 2:
gametext.text = "Yes. A button";
break;
case 3:
gametext.text = "Pressed the button three times.";
break;
case 4:
gametext.text = "It's not going to do anything. It's not.";
break;
case 5:
gametext.text = "Okay, I was lying, there is something here. You have to click five thousand times though.";
break;
case 4999:
gametext.text = "Wow, you really did it. I am impress with your virtuosity. One more!"
break;
case 5000:
gotoAndPlay("winner");
break;
default:
gametext.text = "You need" 5000 - buttonTryPress "more clicks.";
break;} }

It does the first 5 cases just fine, but when it gets to case 6+ it doesn't send the default text. Can someone help me find the problem?

bloodstyle
08-09-2008, 12:45 AM
Nevermind >,<.

edit2: gametext.text = "You need"+(5000 - buttonTryPress)+"more clicks.";

That fixes it :P

Heloed
08-09-2008, 02:44 AM
Awesome, now it works thanks!