Copy link to clipboard
Copied
Hi, I am new to flash cs3 and for my clas project we have to do a flash product. I have made a movie clip which has a button inside and I have coded the button to open another scene but I keep getting ArgumentError: Error #2108: Scene Contactsvid was not found whenever I test it. The actionscript I am using is the following:
stop();
btn_contacts.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandlerbtn_contacts);
function mouseDownHandlerbtn_contacts(event:MouseEvent):void {
MovieClip(root)}gotoAndStop(1, "Contactsvid");
I have entered the name of the scene exactly how its named but it still fails to work.
Please help me
That looks okay, but I think I now see a problem that might be the cause, though I get different results when I test with your code...
MovieClip(root)}gotoAndStop(1, "Contactsvid");
In the middle of that line is a curly brace where a period should be. That brace belong at the end of the function
Copy link to clipboard
Copied
Show the frames panel where you assigned the scene its name.
Copy link to clipboard
Copied
Layer 2 is a video
Copy link to clipboard
Copied
That looks okay, but I think I now see a problem that might be the cause, though I get different results when I test with your code...
MovieClip(root)}gotoAndStop(1, "Contactsvid");
In the middle of that line is a curly brace where a period should be. That brace belong at the end of the function
Copy link to clipboard
Copied
Thank you, now I have a different problem. When I click the button the test I get this message
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Simulator2_fla::MainTimeline/stopDragging()
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).
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.
Copy link to clipboard
Copied
sliderMaster_mc.sliderbtn_mc.stopDrag(); |
this is the code that is causing the error message. I dont see why it is becuase that code is something different
Copy link to clipboard
Copied
Chances are the new error is entirely different from the other one... you solved one and are moving on to the next.
I don't understand why you think that line is not causing the error, though you might be misreading the error message. Show the complete error message... the first line number that gets indicated is the line that is causing the error.
Copy link to clipboard
Copied
ok, this is the error I get when I press the button
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Simulator2_fla::MainTimeline/stopDragging()
I did the debug thing you told me before which told me it was within this
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Simulator2_fla::MainTimeline/stopDragging()[Simulator2_fla.MainTimeline::frame1:16]
heres a screenshot of the debug
Copy link to clipboard
Copied
Insert a couple lines before line 16 that traces the objects used in line 16 to see which is coming up null...
trace(sliderMaster_mc)
trace(sliderMaster_mc.sliderbtn_mc);
Copy link to clipboard
Copied
This is what I got once I put those lines in
[object mcSlider_4]
[object MovieClip]
Copy link to clipboard
Copied
Do those traces precede the error message?
What is the relationship between Simulator2 and Simulator 2.5?
Copy link to clipboard
Copied
Simulator2.swf is the same as 2.5 but when I made a few changes I saved it as 2.5 and when I test 2.5 it still says 2 if that makes sence.
I dont think those traces so precede the error message as when I test it and click the button it says
[object mcSlider_4]
[object MovieClip]
null
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Simulator2_fla::MainTimeline/stopDragging()
Shall I upload my flash file?
Copy link to clipboard
Copied
I've uploaded my file to here as it will probably be easier http://www44.zippyshare.com/v/86546248/file.html
It may give you a error message about low memory but keep pressing ok and it will go away.
The actionscript with the dragging bit is in the layer called 'AS' and the actionscript for the button is within the layer 'iconsinterface/contacts'
Copy link to clipboard
Copied
What needs to be done to have the error occur? If I drag the slider I get the traces and no error.
Copy link to clipboard
Copied
Once youve dragged the slider, click on the top left box that looks like a phonebook with the outline of a person on it.
Copy link to clipboard
Copied
Also forgot to mention earlier, the actionscript for the button is on the last frame of the contacts layer in iconsinterface.
Copy link to clipboard
Copied
Your stage MOUSE_UP listener remains active even though you have left the frame where the slider exists, so when you click on anything afterwards it is unable to find the slider.
Get rid of the MOUSE_UP listener as you have it and rewrite it into the two functions as shown...
sliderMaster_mc.sliderbtn_mc.addEventListener(MouseEvent.MOUSE_DOWN, startDragging);
sliderMaster_mc.sliderbtn_mc.stage.removeEventListener(MouseEvent.MOUSE_UP, stopDragging);
addEventListener(Event.ENTER_FRAME, checkSliderX);
function startDragging(event:MouseEvent):void{
sliderMaster_mc.sliderbtn_mc.startDrag(false, sliderBind);
stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging);
}
function stopDragging(event:MouseEvent) {
stage.removeEventListener(MouseEvent.MOUSE_UP, stopDragging);
sliderMaster_mc.sliderbtn_mc.stopDrag();
}
Copy link to clipboard
Copied
Thank you very much! You have been extremly helpful and quick at replying. Thank you once again
Copy link to clipboard
Copied
You're welcome
Find more inspiration, events, and resources on the new Adobe Community
Explore Now