Be a Supporter!

How do I get these buttons to work?

  • 497 Views
  • 6 Replies
New Topic Respond to this Topic
Kempnerius
Kempnerius
  • Member since: May. 20, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
How do I get these buttons to work? 2005-01-27 22:26:38 Reply

Alright, I'm trying to create a flash document where the user navigates from one page to another by clicking buttons. The problem is, I can't get the buttons to work. How do I make it so that when someone clicks on a button, they go to a different scene?

Nemo
Nemo
  • Member since: Jun. 13, 2003
  • Offline.
Forum Stats
Member
Level 34
Game Developer
Response to How do I get these buttons to work? 2005-01-27 22:30:30 Reply

put something like this in the actionscript for your buttons:

on(press){
_root.gotoAndStop(frame);
}

or

on(press){
_root.gotoAndStop("scene_name", frame);
}

or

on(press){
_root.gotoAndStop("frame_lable");
}

you may not need the _root. in the actions if your buttons are on the main stage


BBS Signature
JKR
JKR
  • Member since: Jan. 1, 2005
  • Offline.
Forum Stats
Member
Level 29
Animator
Response to How do I get these buttons to work? 2005-01-27 22:31:35 Reply

The other thing you can do is label the frame in the other layer. Then Flash can find it no matter where it is.


BBS Signature
Kempnerius
Kempnerius
  • Member since: May. 20, 2004
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to How do I get these buttons to work? 2005-01-27 22:56:01 Reply

Where do I put the action script?

SecretAgentRege
SecretAgentRege
  • Member since: Dec. 31, 2003
  • Offline.
Forum Stats
Member
Level 32
Blank Slate
Response to How do I get these buttons to work? 2005-01-28 02:58:58 Reply

At 1/27/05 10:55 PM, Lilj wrote: Labelings the frames does nothing execpt help you as a personal refrence.

I beg to differ. Labeling frames for navigation is preferred more so over frame and scene numbers. One reason is that Flash and Scenes get buggy. Instead of gotoAndPlay("Scene 2", 1); which can be buggy and may not even work correctly, you can label the frame "Here" and use gotoAndPlay("Here"); and it will goto that frame no matter where it is or where the action is (different scene, etc.).

There are other benefits beyond personal reference, but the avoidance of the Scene Headache is one of the stronger ones. Anyway, it is a good idea to start using frame labels as early as possible, especially for navigation.


Rege.... SecretAgentRege

BBS Signature
Reddz
Reddz
  • Member since: Dec. 5, 2004
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to How do I get these buttons to work? 2005-01-28 04:19:11 Reply

I dont have a problem with scenes. Once you copy the code, go to button actions and paste it in there, and change one little number and no bugs.

I personally use scenes, the frame lable just wastes my time, i think. heh

Benny-Creations
Benny-Creations
  • Member since: Feb. 19, 2004
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to How do I get these buttons to work? 2005-01-28 11:31:55 Reply

the advantage of labelling is that even if you move the frame/keyframe, the label stays with that frame. So you won't have to change gotoAndPlay(10) to 11 for example. VERY handy if you add in a few frames for extra content or whatever :)

Benny_Creations