Copy link to clipboard
Copied
Hi, i'm making a website in flash, and so far everything have gone perfectly fine untill now.
I have made some buttons using MovieClips and then animated them with some actionscript 3. from what i can tell there is nothing wrong with the code itself, the problem is with the MovieClips or Symbols or something...? that what i need help with!
Here is the code for one of the buttons (i use the same code for every button only changing the instance name):
function btn1Over(event:MouseEvent):void{
btn1.gotoAndPlay("Over");
}
function btn1Down(event:MouseEvent):void{
btn1.gotoAndPlay("Down");
}
function btn1Out(event:MouseEvent):void{
btn1.gotoAndPlay("Out");
}
btn1.addEventListener(MouseEvent.ROLL_OVER, btn1Over);
btn1.addEventListener(MouseEvent.ROLL_OUT, btn1Out);
btn1.addEventListener(MouseEvent.CLICK, btn1Down);
And here is the error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at openingscene_fla::MainTimeline/frame107()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::home5_38()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::cartoon2_33()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::about1_28()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::contact3_23()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::donate4_18()
home5, cartoon2, about1, contact3, donate4 is the buttons i use the AS for. But what is wrong with it, i can't understand what sprite/cunstructChildren() meens for example??
Please help me!
1 Correct answer
If you show the error message you are getting, then it might be possible to help you find the problem. If you don't, you've already been told enough such that you should be able to solve the problem yourself, but it's hard to tell if you understand what you are being told.
Copy link to clipboard
Copied
click file/publish settings/flash and tick "permit debugging". the line number with the null object will be in the error message.
if you still need help after doing that copy and paste the error message and your code (like you just did) but highlight the problematic line of code.
Copy link to clipboard
Copied
I don't fully understand what you mean, i've already done all those things you said! The line of code that is problematic is the whole error message, what is it that it's trying to say? Is my actionscript wrong or has it something to do with the movieclips them selves?
I know that the error mesage says that the error occur at fram 107 but i already know that! I know when the error occurs, but i'm trying to find out why it's happening??
I'm pretty much stuck, and can't continue with the website before i've solved it somehow..
Copy link to clipboard
Copied
The 1009 error indicates that one of the objects being targeted by your code is out of scope. This could mean that the object....
- is not in the display list
- doesn't have an instance name (or the instance name is mispelled)
- does not exist in the frame where that code is trying to talk to it
- is animated into place but is not assigned instance names in every keyframe for it
- is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
As kGlad said, if you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved. If you can't see it, then copy/paste the entire error message in your posting.
Copy link to clipboard
Copied
Ok i did that, but when i test the movie (CTRL+ENTER) i get the same error code as before? Should i take Publish Preview or something, cause then i don't get a error code at all?
Copy link to clipboard
Copied
If you show the error message you are getting, then it might be possible to help you find the problem. If you don't, you've already been told enough such that you should be able to solve the problem yourself, but it's hard to tell if you understand what you are being told.
Copy link to clipboard
Copied
I know that it's probably pretty hard to explain how to solve this problem when all you have to go on is my words, but i'vet tried to explain this as exactly as i can.. I have worked with flash a pretty long time now, and made many movies and animations but never worked with actionscript. So this is my first website in flash and i'm really trying to understand the error.. I've already pasted the error code in the first post, here it is again:
TypeError: Error #1009: Cannot access a property or method of a null object reference
at openingscene_fla::MainTimeline/frame107()[openingscene_fla.MainTimeline::frame107:13]
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::home5_38()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::cartoon2_33()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::about1_28()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::contact3_23()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at openingscene_fla::donate4_18()
If it would be simpler i could give you my whole .flp file and you can see for your self what the problem is? I really appreciate the fast replys you have given so far, thank you!
Copy link to clipboard
Copied
The first posting did not include the line number, which is what we've been trying to get you to show. Whatever object is being targeted by code on line 13 of frame 107 is not present in frame 107... it may be there, but has somehow lost its instance name
Copy link to clipboard
Copied
Thank you, thank you so much! That was truly the missing piece in the puzzle! What i had to do to make it work was, i put the layer with the MovieClip Button 1 frame in front of the layer with the AS! so the button layer started at frame 106 and AS layer started at frame 107,i have no idea why it worked but, i don't get the errer anymore and everything works fine!
Thnak you so very much again, now i can finally continue with my site!
Copy link to clipboard
Copied
You're welcome.
Copy link to clipboard
Copied
Nice input!!

