Copy link to clipboard
Copied
Hello,
I have some issues in understanding y i get this error, here is my code for the menu btns of the site:
// handle events for menu btns
weDance_btn.addEventListener(MouseEvent.CLICK, clickWedance);
inFan_btn.addEventListener(MouseEvent.CLICK, clickInFan);
karnivale_btn.addEventListener(MouseEvent.CLICK, clickkarnivale);
outOfSpace_btn.addEventListener(MouseEvent.CLICK, clickoutOfSpace);
nightmare_btn.addEventListener(MouseEvent.CLICK, clickNightmare);
karnivale2_btn.addEventListener(MouseEvent.CLICK, clickKarnivale2);
bucharest_btn.addEventListener(MouseEvent.CLICK, clickBucharest);
function clickWedance(evtObj:MouseEvent) {
//trace shows what's happening .. in the output window
trace("The wedance btn was clicked!");
gotoAndStop("weDance");
}
function clickInFan(evtObj:MouseEvent) {
//trace shows what's happening .. in the output window
trace("The clubspace btn was clicked!");
gotoAndStop("inFan");
}
function clickkarnivale(evtObj:MouseEvent) {
//trace shows what's happening .. in the output window
trace("The kar btn was clicked!");
gotoAndStop("karnivale");
}
function clickoutOfSpace(evtObj:MouseEvent) {
//trace shows what's happening .. in the output window
trace("The outofspace btn was clicked!");
gotoAndStop("outOfSpace");
}
function clickNightmare(evtObj:MouseEvent) {
//trace shows what's happening .. in the output window
trace("The nightmare btn was clicked!");
gotoAndStop("Nightmare");
}
function clickKarnivale2(evtObj:MouseEvent) {
//trace shows what's happening .. in the output window
trace("The carnivale2 btn was clicked!");
gotoAndStop("karnivale2");
}
function clickBucharest(evtObj:MouseEvent) {
//trace shows what's happening .. in the output window
trace("The bucharest btn was clicked!");
gotoAndStop("bucharest");
}
it works with no errors!
But now i need to add another btn on the OutofSpace page and this is it:
spacePic_btn.addEventListener(MouseEvent.CLICK, clickSpacePic);
function clickSpacePic(evtObj:MouseEvent) {
//trace shows what's happening .. in the output window
trace("The SpacePic btn was clicked!");
gotoAndStop("SpacePics");
}
when i test movie in the output i get the error and the btn doesnt work.! Why?
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at WeDance_fla::MainTimeline/frame240()[WeDance_fla.MainTimeline::frame240:26] <<<< >>>> spacePic_btn.addEventListener(MouseEvent.CLICK, clickSpacePic);
at flash.display::MovieClip/gotoAndStop()
at WeDance_fla::MainTimeline/clickoutOfSpace()[WeDance_fla.MainTimeline::frame2:61] <<<<<>>>>> //trace shows what's happening .. in the output window
Note: i put the code for the spacePic_btn on the keyframe where outofspace page starts, it it counts
PLease help.
thank You!
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 declared but not instantiated
- 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).
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 declared but not instantiated
- 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).
Copy link to clipboard
Copied
can you elaborate pls what 1st " - " and 5th " - " means ?
i checked it has corect instance name; the btn exist in the frame where the code is but doesnt exist in the frame where the code tells it to gotoAndStop; also the keyframes labels are correct.
also y do you think it refers to this line too ?
at WeDance_fla::MainTimeline/clickoutOfSpace()[WeDance_fla.MainTimeline: :frame2:61] (on this line is this > //trace shows what's happening .. in the output window)
i dont know what to do
thnk you
Copy link to clipboard
Copied
The 1st one would only apply if you are dynamically creating the object...
var someObj:MovieClip; // declared
var someObject:MovieClip = new MovieClip(); // declared and instantiated
The 5th one involves having the same object in two adjacent keyframes but the name is only assign in the second frame. It will inherit the name (or lack of name) of the one in the frame before it.
Based on the error message, the problem is in line 26 of frame 2. If that line is...
spacePic_btn.addEventListener(MouseEvent.CLICK, clickSpacePic);
Then the problem is that as far as the code is concerned, spacePic_btn does not exist in that frame when the code executes.
If that is not line 26, then if you show line 26 that will be helpful.
Any line numbers after the first iun the error message are just part of the trail that leads to the error occuring
Copy link to clipboard
Copied
My site is very simple regarding the code. i dont have vars,arrays or complex things becuz i dont understand them very well yet. Only my mp3player and xml image gallery are complex but dont have any problems with those.
Yes that is the corect line!
Now i tried to add a fbk btn on the 1st page:
facebook_btn.addEventListener(MouseEvent.CLICK,goThere);
function goThere(e:MouseEvent){
var request:URLRequest = new URLRequest("https://www.facebook.com/wedanceevents?ref=ts&fref=ts");
navigateToURL(request);
}
and got basically the same error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at WeDance_fla::MainTimeline/frame2()[WeDance_fla.MainTimeline::frame2:86] >>> The problem here is that i dont have 86th line of code. My code ends at line 72!
at flash.display::MovieClip/gotoAndStop()
at WeDance_fla::MainTimeline/clickIntro()[WeDance_fla.MainTimeline::frame1:7] >> you said that is the trail of the error. On that frame i have this code :
stop();
logoIntro_btn.addEventListener(MouseEvent.CLICK, clickIntro);
function clickIntro(evtObj:MouseEvent) {
//trace shows what's happening .. in the output window
trace("The intro btn was clicked!");
gotoAndStop("weDance"); >>> and this is line 7
}
Now my site is build like this: 1st frame is a black bg with the Logo that is a btn mc, when clicked it goes to frame 2. All my site with assets starts from frame 2 on every layer. I mean i got nothing on frame 1 of every layer except the layer with the intro! maybe this is not ok..but i dont think so.
I really dont know how tot to fix it .. or how to think it ..maybe redesign some of site elements but dont know how becuz i dont understand what im doing wrong!
Note: if i remove those fbk and spacePic code of btns i dont get the errors.
Note: i think if i will add any new btn on each page i will get errors, and the problem is i really need to add btns(with gotoAndStop and gotoURL) to make the site do what i want.
Do you think is better if i use Scenes? I mean each scene each page?(but i doubt it ..dont know) My pages are structured with frame labels!
What do you think i should do to fix this?
Thank you!
Copy link to clipboard
Copied
Don't use scenes... ever. You'll save yourself some potential grief by avoiding them.
If you have access to a server and can upload your fla file to it and provide a link, I or someone can take a look at it your file to see if we can isolate the problem.
For what you say you have done, things sound correct, but very often there is some misunderstanding about what is truly correctly done.
Copy link to clipboard
Copied
Thank you very much, this is been such a setback to my project and cant fix it.
I need to add fbk btn for every page , each goto different URLS. The spacePic btn on Outofspacepage its suppose to gotoAndStop to a certain frame where my external swf image gallery would be (this i must do for every page add a btn to goto certain frame to load that specific gallery).. but i couldnt do that becuz of that error.
In the library some files are mess but most are categorised.
I'm using CS4! , i tried using CS6 but got some errors from the mp3player and didint know how to fix it and decided to stay with CS4
This is .fla > https://dl.dropbox.com/u/21765376/sitee/WeDance.fla
This is .swf > https://dl.dropbox.com/u/21765376/sitee/WeDance.swf
Thank you again for ur time in helping me fix this major problem for me!
Copy link to clipboard
Copied
And here is what i dont undestand again: i just uploaded the site on my domain to test it and that spacePic btn, when clicked it suppose to goto another framelabel it works !...but when i test the movie in flash it doesnt respond to click and doesnt goto frameabel and get that error...
here is the adress: http://wedance.ro/ > it will be online for 2-3 hours most
Find more inspiration, events, and resources on the new Adobe Community
Explore Now