Copy link to clipboard
Copied
I know what TypeError: Error #1009 is, but I can't seem to figure out what exactly the problem is with my code.
My Code:
MoreWhite.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_53);
function fl_ClickToGoToAndPlayFromFrame_53(event:MouseEvent):void
{
fl_TimerInstance_27.stop();
gotoAndPlay(82, "Scene 15");
GreenCircleWhite.visible = true;
MoreWhite.removeEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_53); <----------------------- This line is where the error occurs when I run the program.
MoreBlack.removeEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_54);
this.stop();
var fl_SecondsToCountDown_5:Number = 2;
var fl_CountDownTimerInstance_5:Timer = new Timer(1000, fl_SecondsToCountDown_5);
fl_CountDownTimerInstance_5.addEventListener(TimerEvent.TIMER, fl_CountDownTimerHandler_5);
fl_CountDownTimerInstance_5.start();
function fl_CountDownTimerHandler_5(event:TimerEvent):void
{
trace(fl_SecondsToCountDown_5 + " seconds");
fl_SecondsToCountDown_5--;
if(fl_SecondsToCountDown_5 == 0)
{
BlueCircleBlack.visible = true;
trace("Trial Number: 7" + "\nTrial Type: Disagreement" + "\nInitial Choice: 0");
gotoAndPlay(82, "Scene 15");
}
}
}
This code is just a duplicate of another code that are on different scenes.
All my scenes have the same code, but with different numbers added onto each variable to make it different.
All those other scenes work just fine, but it's this particular set of code that doesn't work at all.
Any ideas on what the problem is? I'll provide extra information if it helps coming up with a solution.
Copy link to clipboard
Copied
If the line you point to is where the error occurs then it means that when that line executes there is no MoreWhite object present, at least not by that name. Try moving the lines that remove the listeners before the lines where you change to other frames.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now