So I have an assignment for school due next week, but I'm getting an error. I asked my T/A about it, but she wasn't sure either. I've looked around on Google and this site for a while, but couldn't find anything to help me. The exact output/error is this:
1:false
usedfunction Function() {}
Maybe
TypeError: Error #1006: value is not a function.
at Assign6/usedAnswer()
at Assign6/ballEndDrag()
The problem seems to be within the if statement
if(usedAnswer(msg)==false)
The program is not even tracing a value for
trace(usedAnswer(msg));
Any help would be appreciated. Thanks so much!!
package
{
import flash.display.*;
import flash.events.*;
public class Assign6 extends MovieClip
{
var ballDisplay:Array = new Array("Yes","No","It is certain!","Ask again","Try again","Better not","Most likely","Maybe","Reply is No","Doubtful","Outlook good");
var usedList: Array = new Array();
var magicInt:Number;
public function Assign6()
{
magicBall.addEventListener( MouseEvent.MOUSE_DOWN, ballStartDrag );
magicBall.addEventListener( MouseEvent.MOUSE_UP, ballEndDrag );
}
// When the user presses the mouse down on magicBall, this function is called
function ballStartDrag( evt: MouseEvent )
{
magicBall.startDrag( );
magicBall.magicText.text = " ";
magicBall.eightDisplay.text = "8";
}
// When the user lets the mouse up on magicBall, this function is called
function ballEndDrag( evt: MouseEvent )
{
magicBall.stopDrag( );
magicBall.eightDisplay.text = " ";
var checkVal = false;
while(checkVal==false){
trace("1:" + checkVal);
trace("used" + usedAnswer);
var msg:String = randomAnswer();
trace(msg);
trace(usedAnswer(msg));
if(usedAnswer(msg)==false){
usedList.push(ballDisplay[magicInt]);
checkVal = true;
trace("2" + checkVal);
}
}
}
//Display random answer in magicText
function randomAnswer( ):String
{
magicInt = Math.round(Math.random() * 11);
magicBall.magicText.text = ballDisplay[magicInt];
return ballDisplay[magicInt];
}
// Check whether answer has already been used
// Returns true if answer is in usedList and false if not
function usedAnswer( answer: String ): Boolean
{
var i = 0;
for (i==0; i<usedList.length(); i++)
{
if (answer == usedList[i])
{
return true;
}
}
return false;
}
}
}