PDA

View Full Version : Code Doesnt Work


Xionraseri
02-23-2008, 11:23 PM
Im a complete noob to coding, and following code sucks... Can someone please tell me how to fix this code? I am trying to create a type command game, and the input is an input text box that the user types in.

btnBack.onRelease = function (){

switch(input){
case input = help:
_root.gotoAndStop("Help");
break;
case input = checkdoor:
_root.gotoAndStop("CheckDoor");
break;
} // end switch
}// end release

the binary
02-23-2008, 11:49 PM
try something like this..
were 'intput' has to be a string (e.g. the user-input from the textfield)


//-- sample-var
var input:String = myTextField.text;

btnBack.onRelease = function ()
{
switch (input)
{
case "help" :
trace('help');
_root.gotoAndStop("Help");
break;

case "checkdoor":
trace('checking door');
_root.gotoAndStop("CheckDoor");
break;
default:
trace('unknown command');
} // end switch
}// end release


regards

Xionraseri
02-24-2008, 12:27 AM
Awesome, Thanks! it works now