Murphos Murphos - 4 months ago 15
ActionScript Question

Actionscript 3; error 1086

Currently coding a game in Actionscript 3, and the following function keeps spitting out this error;

function checkAnswer(e:KeyboardEvent):void{
var input:String(this.userInput.text).toLowerCase();
var currentLetter:int;
var currentWord = currentFruit;
while (currentLetter < input.length){
if (this.currentWord.charAt(currentLetter) == input.charAt(currentLetter)){
trace("correct");
} else {
trace("incorrect");
};
currentLetter++;
}

};


And the error;

Scene 1, Layer 'Actions', Frame 1, Line 81 1086: Syntax error: expecting semicolon before leftparen.


I have no idea why it is doing this. Does anyone have any clue? Can anyone help?

Answer

change

 var input:String(this.userInput.text).toLowerCase(); 

to

var input:String = this.userInput.text.toLowerCase();
Comments