Skip to main content
Participant
May 2, 2006
Question

Annoyingly simple

  • May 2, 2006
  • 4 replies
  • 348 views
Hey,

This is such an elementary problem which I am sure everyone one of you could solve, but at the moment I cannot do it and its giving me a headache. Basically I have a button with an instance name of goPlay_btn and I want it to go to Scene 8 on release. I have tried all the usual methods but I keep getting this error:

Statement must appear within on handler

This is the code I have put in:

goPlay_btn.onRelease = function (){
gotoAndPlay("Scene 8", 1);
};


What is going wrong?!

Any help appreciated!

Regards,

Adam Justice
This topic has been closed for replies.

4 replies

Participating Frequently
May 2, 2006
Also, where did you put the AS? Best bet would be on the button itself, then you only need:
on (release) {
gotoAndPlay("scene_name");
}
Participant
May 2, 2006
Hey thanks everyone, I ended up just putting the code in the timeline, and then it worked.

Thanks!
Participating Frequently
May 2, 2006
You have to specify the name of the scene, not Scene 8 unless that is the actually name. For instance if the 3rd scene is named scene_number_three you would use
gotoAndPlay("scene_number_three") not gotoAndPlay("Scene 3");

You don't *need* a frame number as it will assume frame 1, unless you don't want frame 1. Becareful you aren't accidentally refering to a frame.

BTW, gotoAndPlay(8); will play from frame 8 of the current movie and timeline
May 2, 2006
Hi Adam.....funny my last name is Justice as well. I take it this code is appearing on your main timeline and not inside the timeline of another clip or on the button itself.

That being said did you try:

goPlay_btn.onRelease = function() {
gotoAndPlay("Scene 8");
}

also try:

goPlay_btn.onRelease = function() {
gotoAndPlay(8);
}

Just to make sure you don't have a frame name issue.

Let me know.


Inspiring
May 2, 2006
Looks like you are trying to put this code on a button or some other symbol.
Put it on the timeline.

--

Dan Mode
*Must Read* http://www.smithmediafusion.com/blog
*Flash Helps* http://www.smithmediafusion.com/blog/?cat=11

"goldfingeratb" <webforumsuser@macromedia.com> wrote in message
news:e38k40$e31$1@forums.macromedia.com...
> Hey,
>
> This is such an elementary problem which I am sure everyone one of you
> could
> solve, but at the moment I cannot do it and its giving me a headache.
> Basically
> I have a button with an instance name of goPlay_btn and I want it to go to
> Scene 8 on release. I have tried all the usual methods but I keep getting
> this
> error:
>
> Statement must appear within on handler
>
> This is the code I have put in:
>
> goPlay_btn.onRelease = function (){
> gotoAndPlay("Scene 8", 1);
> };
>
> What is going wrong?!
>
> Any help appreciated!
>
> Regards,
>
> Adam Justice
>