Copy link to clipboard
Copied
Hey folks, I'm getting the following error when I try to run the script...
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at SAFEBOOT_SIMULATOR_fla::MainTimeline/pm_MouseOutHandler()[SAFEBOOT_SIMULATOR_fla.MainTimeline::frame1:11]
Below is the code, line 11 frame 1 is highlighted to make it obvious... PMODE1 is an image being used as a button with a rollover effect.
//PRESENTATION MODE
PMODE1.addEventListener(MouseEvent.MOUSE_OVER, pm_MouseOverHandler);
function pm_MouseOverHandler(event:MouseEvent):void
{
PMODE1.visible=false;
}
PMODE2.addEventListener(MouseEvent.MOUSE_OUT, pm_MouseOutHandler);
function pm_MouseOutHandler(event:MouseEvent):void
{
PMODE1.visible=true;
}
//SIMULATION MODE
SMODE1.addEventListener(MouseEvent.MOUSE_OVER, sm_MouseOverHandler);
function sm_MouseOverHandler(event:MouseEvent):void
{
SMODE1.visible=false;
}
SMODE2.addEventListener(MouseEvent.MOUSE_OUT, sm_MouseOutHandler);
function sm_MouseOutHandler(event:MouseEvent):void
{
SMODE1.visible=true;
}
SMODE2.addEventListener(MouseEvent.MOUSE_DOWN, sm_mouseDownHandler);
function sm_mouseDownHandler(event:MouseEvent):void
{
gotoAndStop(1, "Scene 3");
}
//EXIT BUTTON MOUSEOVER
EXIT1.addEventListener(MouseEvent.MOUSE_OVER, eb_MouseOverHandler);
function eb_MouseOverHandler(event:MouseEvent):void
{
EXIT1.visible=false;
}
EXIT2.addEventListener(MouseEvent.MOUSE_OUT, eb_MouseOutHandler);
function eb_MouseOutHandler(event:MouseEvent):void
{
EXIT1.visible=true;
}
EXIT2.addEventListener(MouseEvent.MOUSE_DOWN, eb_mouseDownHandler);
function eb_mouseDownHandler(event:MouseEvent):void
{
fscommand("quit");
}
PMODE2.addEventListener(MouseEvent.MOUSE_DOWN, pm_mouseDownHandler);
function pm_mouseDownHandler(event:MouseEvent):void
{
gotoAndStop(1, "Scene 2");
}
stop()
I'm thinking that I have NO clue why this occurs and I will provide love and good thoughts for anyone who can (simply) explain whats causing the error, and point me in the direction of fixing it.
Tim.
PS, Just noticed that it still runs beyond the error... with no obvious ill effects.
OMG.
I'm really not 100% sure I understand entirely why (although I think I get the gist), but I decided that this MUST be something to do with the fact that it's trying to run a script on an image that is no longer there....
let me explain...
I read somewhere that GOTOANDSTOP runs the entire script through (whether a check or actually running it I don't know) but it occurs that the images are no longer avilable in the new frame... So I copied them to a new layer, sent them to the back, voilla.
Err
...Copy link to clipboard
Copied
Error 1009 is prominently featured here
Copy link to clipboard
Copied
Is this error occuring when you first try to test the file or does it happen at some point later after the file has started running successfully? If it's the latter, does it happen when you rollout of PMODE2.
Copy link to clipboard
Copied
Ned... The file launches, Rolling out and in works fine, but hitting the button PMODE2 is what causes the error. Hitting OK then continues on normally. Also noted that (although no content exists) SMODE2 does the same thing.
Moccamaximum, thanks for that, I'll take a peek from work tonight.
Copy link to clipboard
Copied
OMG.
I'm really not 100% sure I understand entirely why (although I think I get the gist), but I decided that this MUST be something to do with the fact that it's trying to run a script on an image that is no longer there....
let me explain...
I read somewhere that GOTOANDSTOP runs the entire script through (whether a check or actually running it I don't know) but it occurs that the images are no longer avilable in the new frame... So I copied them to a new layer, sent them to the back, voilla.
Error gone.
Thank you both for your time to read and provide answers, I just wish it had ocurred to me to do the above before posting here! Hopefully this will save someone else a headache!
Copy link to clipboard
Copied
That's the basic premise of the 1009 error... you are trying to target an object thqt does not exist as far as the processor sees it. There are a number of ways this can happen, but they all basically boil down to indicating that an object your code is targeting does not exist when that code executes.