Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NEWBIE - Buttons loop through scenes. 1

Status
Not open for further replies.

pixsurreal

Technical User
Nov 9, 2005
4
US
I am creating my first flash website for a class portfolio. Each section of my site is in a separate scene. The buttons are suposed to take you to the appropriate section (scene) on release. In stead, they loop through the secnes in the order they are listed in the scene drop-down list. It doesn't matter if you hit the same button continuously or switch buttons, it just keeps moving on to the next scene as buttons are pushed, then jumps back to the beginning and loops again. I used script assist to write the code. Please, are there any ideas as to why I am having this problem?
 
on (release) {
gotoAndPlay("clients", 1);
}



I tried to use gotoAndStop and was unsucessful, so I changed to this and added the stop command in the first frame of each scene (everything is in layers in a single frame of each scene).
 
I guess to clarify things . . . it does stop at each scene. It's just that when you push one of the buttons to move to a different section, rather than moving to that section it just goes to the next one in the order that they are listed in the dropdown menue for the list of scenes.
 
Never target a scene name in your Flash life again, and only target labeled frames.
Thus label the first frame of each scene with an unique frame label such as clients (no number only labels or at least not starting with a number, no caps, no spaces and no special characters other than the underscore...), add the targeted timeline (in your case _root or _level0) and only target the labeled frame on your buttons' scripts...

on(release){
_level0.gotoAndStop("clients");
}

Regards. Affiliate Program - Web Hosting - Web Design

03/13/05 -> OLDNEWBIE VS FLASHK
 
I have the script on each button instance. Is this still the correct syntax for that situation? Also, to what does _level0 refer? Am I better off placing each section in indvidual frames within the same scene? Do I still need the stop code if I am using gotoAndStop? Thank you so much for your help.
 
Of course you have to use different frame labels for each scene, clients possibly for the first frame of the clints scene, but other labels for the first frames of the other scenes.
And of course use the appropriate label on each button.

You don't really need a stop(); action when using gotoAndStop(), but there's no harm in leaving it there, unless you had more than one frame, and you wanted it to play...

_level0 is the same as _root, and targets the main timeline, on which are your scenes and frame labels.

It would work as well if you only had one scene, but still targeted labeled frames in the same manner.

Regards. Affiliate Program - Web Hosting - Web Design

03/13/05 -> OLDNEWBIE VS FLASHK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top