Ok I’m making a hang man app in AS3 and when I try to run or debug it I get this error.
TypeError: Error #1006: charAt is not a function.
at Hangman_fla::MainTimeline/loadingText()[Hangman_fla.MainTimeline::frame1:93]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
I’m not entirely sure what it all means since I’m extremely new to AS3. So can someone please help me. Also I pasted the code function that charAt is a part of below.
if(words.charAt(i)!= " ")
{
underline = new Underline();
underline.x = tempText.x + tempText.width/3;
underline.y = tempText.y + tempText.height/2 + 5;
textContainer.addChild(underline);
}
}
textContainer.x = stage.stageWidth / 2 - textContainer.width/2;
}
function guess(event:MouseEvent):void
{
var wordLC:String = randomWords.toLowerCase();
if(guess_txt.text != “”)
{
if(wordLC.indexOf(guess_txt.text) != -1)
{
for (var i: uint = 0; i < textFields.length; i++)
{
if(wordLC.charAt(i) == guess_txt.text)
{
textFields*.text = randomWords.charAt(i);
numCorrect ++;
if(numCorrect >= totalLetters)
{
endGame(“You Win”);
}
}
}
}