I am trying to create a button inside a movie clip that will go back to Scene 1.
Here is my code
stop();
sback1_btn.addEventListener(MouseEvent.CLICK,film1);
function film1(event:MouseEvent):void{
gotoAndStop("shorts");
}
I keep getting Access of undefined property error.
Can anyone help?
Thank you.
First, go into your Flash Publish Settings and select the option to Permit Debugging. Then run the file and copy the entire error message and place it in your next response.
In the error you might see a line number following the first frame numnber that is mention. That will be the line of the code that has the problem.
If it happens to be the line of code you show, then my first suspiscion would be that you have not assigned the instance names to the objects (via the Properties panel where it says "<Instance Name>").
If you have named things properly, do you happen to animate things into place? If that's the case, then you need to assign the instance names in all keyframes.
If you don't animate things into lace and the naming is okay, then is the button on a frame other than frame 1 of the movieclip such that it doesn't exist when that line of code is executing?
I don't see the properties panel with the <Instance Name> for the mcVideoMask showing. You need to have that object selected on the stage for the Properties panel to show that.
Seeing that timeline tween in the timeline leads me to repeat something I said earlier.... If you have named things properly, do you happen to animate things into place? If that's the case, then you need to assign the instance names in all keyframes.
Here's what the pictures tell me. The code your are trying to assign to the button is inside the VideoMask object, so here are your options.
Try moving that code the the main timeline into frame 2.
OR
Go back to having your code the way you started, with the change that Esdebon offered.
In both cases, you need to make sure you have assigned the instance name to the button in every keyframe of its tmeline, especially frame 1. Objects will inherit the names you assign in preceding sequencial frames regardless of what you name them later, so you need to make sure you assign the name in frame 1 or else that lack of a name will be inherited in frame 15.
try
sback1_btn.addEventListener(MouseEvent.CLICK,film1);
function film1(event:MouseEvent):void{
MovieClip(root).gotoAndStop("shorts");
}
or
MovieClip(root).VideoMask.sback1_btn.addEventListener(MouseEvent.CLICK ,film1);
function film1(event:MouseEvent):void{
MovieClip(root).gotoAndStop("shorts");
}
The problem is the path
North America
Europe, Middle East and Africa
Asia Pacific