Button navigation to diff scenes

  • Aanish
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 28, 2004
  • Posts: 8
  • Status: Offline

Post January 28th, 2004, 1:12 pm

Hi,

I am a novice Flash user and i have 6 scenes in my project.
I have a menu scene with 5 buttons to select each scene. i want to click on a button and on releasing it , should play a particular scene.

i cant get it to do that, i have this

on (release) {
_root.gotoAndPlay("FrameLabel_I_used_to the scene i wanttogo to");
}

where do i put this piece of code? and is this right?

Thank you
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 28th, 2004, 1:12 pm

  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post January 28th, 2004, 2:54 pm

I'm a little confused as to weather you want to navigate to a scene, or a frame with a frame label.

Otherwise, you should select the button on the stage (don't edit the button) and go to your actions panel. That's where your code goes.
- dM
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post January 28th, 2004, 2:58 pm

dM: Flash has an issue where if you try and navigate to a scene from a button that is contained with another movieclip and not on the main timeline you can't. So the typical workaround to switching between scenes is to give the first frame in that scene a frame label then use _root.gotoAndPlay("frameLabel") to go there.

@Aanish: That code is correct, and it goes directly on your button (right click on your button, open the actions panel, add those actions). However there are 2 things you must make sure you have done...

1) Give the first frame in your scene a frame label (right click on the frame, open the properties panel)

2) Change "FrameLabel_I_used_to the scene i wanttogo to" to the correct frame label.

Sure these are obvious, but as far as I can see, these could be the only things going wrong.

Unless of course you are loading this movie into another movie via loadMovie(), if that is the case then it is the _root that is messing it up.
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post January 28th, 2004, 3:10 pm

cool. never run across that. thanks LIB!! :)
- dM
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post January 28th, 2004, 3:28 pm

No problem dM, glad to help :)
  • Aanish
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 28, 2004
  • Posts: 8
  • Status: Offline

Post January 28th, 2004, 3:28 pm

Thanks,

but thats what i have done and with no success.
when you say " That code is correct, and it goes directly on your button (right click on your button , open the actions panel, add those actions)"

Should i place this code on the button in the main timeline or the buttons timeline? i think it should be on the main timeline.

PS: iam working with Flash MX ver 6.0
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post January 28th, 2004, 3:31 pm

You can't put any actions in a button timeline they won't work ;) Also since this code is in an on handler, you wouldn't be able to put it on a frame anyway since an on handler is for a button symbol and as of Flash MX a movieclip symbol as well.

You will have to put it directly on the button... you do this by right clicking on the button, choosing "Actions" from the context menu, and placing the actions you want within the actions panel.
  • Aanish
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 28, 2004
  • Posts: 8
  • Status: Offline

Post January 29th, 2004, 3:37 pm

Thankyou very much, that works well.
  • Aanish
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Jan 28, 2004
  • Posts: 8
  • Status: Offline

Post January 31st, 2004, 2:38 am

As i explained before i have one menu scene and 5 buttons on that scene which i use to access 5 other diff scenes.

i did name the first frame of a scene as "framelable" and with the appropriate actions on the button was able to access that scene.

on (release) {
_root.gotoandPlay("framelable");
}

but when i name another scene as"framelable2"
and place these actions on another button:

on (release) {
_root.gotoandPlay("framelable2");
}

it fails to work, any IDEAS??? why???

Thank you so much in advance.
  • UNFLUX
  • Genius
  • Genius
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 6382
  • Loc: twitter.com/unflux
  • Status: Offline

Post January 31st, 2004, 9:21 am

well the problem is that you are using scenes. :shock:
Scenes are messy and tough to deal with at times...like now.
I would suggest looking into using Movie Clips instead. You'll
find it's MUCH EASIER to understand and control.

However, to get this to work, you have to realize that your AS
on your buttons are only applying to the scene they are on. So,
that's why 1 works, and the other don't. Your code is telling the
buttons to go to framelabel2 on THAT scene, which obviously
doesn't exist.

What you need to is simply add to your buttons which scene
they are being directed to play that frame. something like this:
Code: [ Select ]
on(release){
    gotoAndPlay("SCENE", "framelabel");
}
  1. on(release){
  2.     gotoAndPlay("SCENE", "framelabel");
  3. }
UNFLUX.FOTO
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post January 31st, 2004, 10:08 am

UNFLUX wrote:
However, to get this to work, you have to realize that your AS
on your buttons are only applying to the scene they are on. So,
that's why 1 works, and the other don't. Your code is telling the
buttons to go to framelabel2 on THAT scene, which obviously
doesn't exist.

What you need to is simply add to your buttons which scene
they are being directed to play that frame. something like this:
Code: [ Select ]
on(release){
    gotoAndPlay("SCENE", "framelabel");
}
  1. on(release){
  2.     gotoAndPlay("SCENE", "framelabel");
  3. }
You are 100% right about scenes being difficult to manage and use... I personally hate scenes.

However, the rest isn't exactly correct. When you target a frame label it doesn't matter which scene it is in, it will still go there. That is why the method worked the first time. And it is the gotoAndPlay("SCENE", frame) method that is buggy in Flash and won't work when inside a movieclip symbol, the button must be contained in the main timeline for something like this to work.

@Aanish: I'm not entirely sure if this is right or not, but I don't believe frame labels can contain numbers. Try changing it to framelabelTwo and see what happens.
  • UNFLUX
  • Genius
  • Genius
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 6382
  • Loc: twitter.com/unflux
  • Status: Offline

Post January 31st, 2004, 12:11 pm

hmm...ok well i tested it to see, but i only used 2 scenes and
2 buttons. Good to know, but not sure why it worked. :?
UNFLUX.FOTO
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post January 31st, 2004, 12:32 pm

It works because when you publish your movie flash doesn't have "scenes" it combines everything into 1 long timeline (which is why if you don't add a stop() action at the end of your scene it just plays right into the next scene).
  • UNFLUX
  • Genius
  • Genius
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 6382
  • Loc: twitter.com/unflux
  • Status: Offline

Post January 31st, 2004, 12:33 pm

ohhhhh...never realized that. doh! :P
UNFLUX.FOTO
  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Joined: Jun 26, 2003
  • Posts: 1402
  • Loc: Philadelphia, PA
  • Status: Offline

Post January 31st, 2004, 12:36 pm

Yeah scenes are apparently supposed to be for organizational purposes, but really they just make it messy for you (something you learn when you get more into loading in external movies and whatnot).
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 31st, 2004, 12:36 pm

Post Information

  • Total Posts in this topic: 17 posts
  • Users browsing this forum: No registered users and 37 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.