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

looking for the best way to implement a Next / Previous navigation

Status
Not open for further replies.

fiuPikeOY

Programmer
Jun 14, 2004
143
US
Hello,

I'm developing a training in Flash with many chapters. The user can navigate by means of Next/Previous or they can click on a master navigation button corresponding to the chapter they want to jump to. I want to do this in the most dynamic way possible. Meaning I don't want to hard-code where to go each time.

Can someone give me some ideas on how to set up a navigation like this? Some tutorials?

Thanks in advance
 
well if things are set up frame by frame, you can have the buttons simply say:

on (release) {
gotoAndStop(nextFrame);
}

another option is very similiar, and my preference:

on (release) {
gotoAndStop(_currentFrame+1);
}

Also, for going back, you can have:

on (release) {
gotoAndStop(previousFrame);
}

or, once again my preference and more obvious:

on (release) {
gotoAndStop(_currentFrame-1);
}

Helpful? If you have each chapter in separate scenes of something though, you would have to hard code the last frame of each scene, since i don't know of a way to dynamically change scenes.

 
The correct syntax would be...

on(release){
this.nextFrame();
// or this.prevFrame();
}

And _currentframe is not written with a capital "F".

Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Oh, sorry, my bad. I couldn't remember, so i just put down what seemed correct to me at the time.

 
Oldnewbie,

I'm having a problem with a preloader you once gave me, and I can't figure out why it's doing this.

the preloader is in level5, but the swf it's preloading is loading in level10.

I put certain trace messages inside the preloader function, and it's going inside the if (percent==100), but it's not showing the last message. Do you know why?

thanks

Here's the code for the preloader


this.onEnterFrame=function(){
trace("I'm inside the function");
//trace the percentage of the movie that has loaded
percent=(_level10.getBytesLoaded()/_level10.getBytesTotal())*100;
trace(percent);

if(!isNan(percent)){
// The following only concern the preloader's displays...
if (percent == 0) {
percent_display = "";
} else {
percent_display = Math.ceil(percent) + "% LOADED.";
}
this.loadbar._visible = true;
this.loadbar._xscale = percent;
if (percent > 1) {
this.reelmc._visible = true;
}
// End of preloader's displays...
}
if(percent == 100){
trace("Inside the if");
//trace(percent);
// this sends this preloader clip back to frame 1
// where it awaits the next call to it...
this.gotoAndStop(1);
// this deletes this onEnterFrame event...
// so that the movie clip stops looping...
delete this.onEnterFrame;
// preloader's displays handling...
this.reelmc._visible = false;
percent_display = "";
this.loadbar._visible = false;
// end of preloader's displays handling...
_root.gotoAndStop("stopped");
_level0.isLoaded = "yes";
trace("I got to the end")
}
}
stop();
 
Why is the preloader on level 5?

And I don't remember the first 2 following lines being in my preloader...

_root.gotoAndStop("stopped");
_level0.isLoaded = "yes";
trace("I got to the end");

I'd have to have a look at allyour .flas, zipped up and in a MX only format, not MX2004.

You would have to save a copy of your MX2004 .flas, (using Save as...) and changing the Document type to MX only in the Save as... window.

You find my e-mail address if you hit my handle in one of my posts!



Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Ok thanks a million, I just sent an email to your hotmail accounts with a link to the zip file. I saved all the flas as MX.

Let me know as when you have anything. This is driving me crazy.

Thanks again
 
A bit hard to test your files with all that you've commented out...
From what I can see, the preloader seems to be working fine and I do get all of your traces... Although I think you have a typo on this line...

_level0.isLoaded = "yes";

It should I guess be level 10, and not level 0 as you have it... Anyways, I can find that isLoaded variable anywhere else!

The problem seems to be the _level0.step variable as it is apparently used to send the loaded movies to the appropriate frame, and 1 doesn't make sense regarding the intro.swf and navigation.swf, which both have nothing on their first frames. Furthermore that same variable is used in th outerframe.swf in the numbertextfield of the current step, so that adds to my confusion...

Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Actually, I'm not using that isLoaded variable anymore. That's why you can't find it. It was originally declared in level0, which is why you see level0.isLoaded. I'm getting most of the traces too, except the most important one...the one on masterPreloader.fla frame 10. There's a command at the end of the preloader to go there. I only get this one the first time (when it loads). It doesn't go to that frame any other time, yet it preloads. That's what's driving insane.

Thanks a lot for all your help. Let me know if you find what I'm doing wrong
 
Oh man....I think I found the problem.

right now I have _level10.gotoAndPlay(_level0.step), which is understanding to go to frame number _level0.step, but I need it to go to frame Label _level0.step. What's the syntax for this. Translating a variable as a frame label.

Thanks
 
Ok... Just noticed you had labeled frame 5 of your intro.swf with "1", and as I answered your new thread, that won't work...
Furthermore you should really be using gotoAndStop rather than a gotoAndPlay and adding a stop action on the targeted frame.

Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top