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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

navigation buttons - actionscript

Status
Not open for further replies.

cathiec

Programmer
Oct 21, 2003
139
IE
i have a flash movie with several layers. one of the layers is called slides and has 17 frames, each frame is labeled starting with frame1 to frame17. when i label the frames a little red flag appears in the time line in the frame. each of these frames displays a text box with text in it. i created a new layer called navigation. on this layer i put three buttons to jump to certain frames in the movie.

i am using the following actionscript for each button:
onClipEvent (load) {
gotoAndStop("Scene 1", "frame7");
}

but when i test the movie nothing happens. i tried putting the buttons directly onto the slides layer but nothing happen when i do this either.
 
OnClipEvents are used for movieclips.

Try something like

Code:
on (release) {
	gotoAndStop("frame7");
}

As far as I know there is no need to address the scene when the frame that is targeted is in the same scene.

regards

tektips.gif
 
By the way... is there a special reason to label your frames? You could target them using the framenumber as well.

Code:
on (release) {
    gotoAndStop(7);
}





regards

tektips.gif
 
Targeting scene names is most of the time useless. You should use (as you were!) labeled frames or frame numbers.
Labeled frames are ALLWAYS better than frame numbers, since frame numbers are cumulative on the main timeline, for example. Thus if you edit previous scenes (shorten them for example) to the targeted frame, then you would have to correct all of your goto's, since each actual frame number would change. Frame labels remain attached to each particular frame (unless you delete them), no matter what edits you do in your movie.
Also, most of the time, _root or _level0 has to be added to the path in your scripts, so why not do so all the time?
Code:
on(release){
    _root.gotoAndStop("frame_label");
}

Regards,

cubalibre2.gif
 
thanks for that, it worked perfectly! i have a another question for you. i have another button called index and i want this to open a webpage called index.html. This page index is in the same directory as the .fla file. When i click on the button the directory folder and its contents are opened in a new window instead of the page. here is the action script that i am using:

on(release){
getURL(index.html,["_blank"]);

}
 
I think you want:

on(release){
getURL(index.html,"_self");

}
instead of "_blank" to open the page in the same window. Unless things have changed since Flash 5.
 
OIC, you're saying the problem isn't where it's opening, but, rather, what it's opening....sorry, I misread.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top