PDA

View Full Version : Mouseclick unexpected Error


cmfx_2
03-25-2010, 08:11 PM
Sorry to bother with the super basic question. But I'm afraid it's preventing me from even getting off the ground.

Trying to get my flash site going, I've added my buttons (links). I go to add my eventlistening code:


4: stop();
5:
6: function goLandscape (e:MouseEvent):Void{
7: gotoAndStop(4);
8: }
9:
10: land_btn.addEventListener(MouseEvent.CLICK, goLandscape);



and I receive the error:

Line6: '{' expected
Line 8: Unexpected '}' encountered

I have tried giving my frame a proper label (naming the frame), have tried removing "Void" , have tried swapping location of function and function call.

I'm positive I have the function and listener coded properly. And I don't see any reason why this is happening. What is the problem??

gangstareef
03-31-2010, 05:55 PM
Looks like you have an extra space between the name of your function, goLandscape, and the parentheses that enclose its parameter list, (e:MouseEvent).

In other words, you have this: goLandscape (e:MouseEvent)
when you should have this: goLandscape(e:MouseEvent).

Those parens are part of the function call, so that's one place you're not allowed whitespace.

relaxatraja
04-05-2010, 12:15 PM
Void should not be in initial CAPS. Please change it to void.

relaxatraja
04-05-2010, 12:16 PM
And also try if you are in the root timeline:

MovieClip(root).gotoAndStop(4);