I am having a problem with AS 3.0
When you click on a door. You’ll move to the next frame.
In the next frame i tried the same. But its not working.
This is the code:
FRAME1;
stop();
deur1.addEventListener(MouseEvent.CLICK, frame2);
function frame2(event:MouseEvent)
{
gotoAndStop(2)
}// This part works. I am now in frame 2.
FRAME2:
deur2.addEventListener(MouseEvent.CLICK, frame3);
function frame3(event:MouseEvent)
{
gotoAndStop(3)
}
deur1=door1. deur2=door2
The doors are a Buttons.
When i run this project. All i see are all my frames for each FPS.
This is the compile error i get:
Compile errors
Scene 1, layer ‘layer1’ Frame 2, line 1: 1023 Incompatible override
Scene 1, layer ‘layer1’ Frame 2, Line 1: 1021 Duplicate function definition.
Scene 1, layer ‘layer1’ Frame 2, Line 3: 1000 Ambiguous reference to frame2
MainTimeLine, Line2: 1000 ambiguous reference to frame2.
You get those Compile errors because of the names you are using for the functions. It seems “frame2” and “frame3” are reserved names. Try to use more descriptive names for your functions, it will help you (and others) to understand your code, and this way you are less likely to run into errors like these.
Try this (I also corrected the formatting to improve readability):
On frame 1:
On frame 2: