Avatar of bioterror
bioterror
 asked on

navigation - prevent user from skipping ahead

I am using Flash 6 for development.  I have created a tutorial which consists of five modules, all in one fla.  I want the user to be able to navigate to the first module.  Once completed the user can go to the second module, but also review the first whenever s/he wants.  The idea is to be able to view current and previous modules, but not skip ahead (let's say from module 1 to module 4) without completing the prior modules (including end of module quiz).  I have navigation tabs on top, but was thinking of dimming the ones not available (not imperative).  The way it currently is set up is to allow access to any module, regardless of whether they covered the material or not.  Any thoughts on how I should proceed?  Thanks in advance for any help.
Adobe Flash

Avatar of undefined
Last Comment
rascalpants

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
rascalpants

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
henryww

i think a simpler way will be only a single variable instead.

//frame 1
module=0;

say u have 5 modules, at the end of the

//module1
/:module=1;

//module2
/:module=2;

.. etc

//on those buttons

//button 1
on(release){
  if (/:module >= 1) {
    _root.module.gotoAndPlay("stage1");
    // or whatever that is
  }
}

//button 2
on(release){
  if (/:module >= 2) {
    _root.module.gotoAndPlay("stage2");
    // or whatever that is
  }
}

... etc & so on ...



just an alternative to save from using the array for 5 modules, looping etc.

rp's solution works perfect and is great for a lots for different modules and not in sequential access order, say user can do 1, 4, 5 .. etc, and go back to see those are done.

// but using boolean instead of string will make it a bit faster and easier ...  don't have to assign initial value, no string comparison is needed
just a suggestion :)

//main frame1
button = new Array();

//module 1 last frame
/:button[1] = true;

// button 1
if (/:button[1]) {
  // do something here
  // allow switch of module, etc
}

cheers
henryww

i think a simpler way will be only a single variable instead.

//frame 1
module=0;

say u have 5 modules, at the end of the

//module1
/:module=1;

//module2
/:module=2;

.. etc

//on those buttons

//button 1
on(release){
  if (/:module >= 1) {
    _root.module.gotoAndPlay("stage1");
    // or whatever that is
  }
}

//button 2
on(release){
  if (/:module >= 2) {
    _root.module.gotoAndPlay("stage2");
    // or whatever that is
  }
}

... etc & so on ...



just an alternative to save from using the array for 5 modules, looping etc.

rp's solution works perfect and is great for a lots for different modules and not in sequential access order, say user can do 1, 4, 5 .. etc, and go back to see those are done.

// but using boolean instead of string will make it a bit faster and easier ...  don't have to assign initial value, no string comparison is needed
just a suggestion :)

//main frame1
button = new Array();

//module 1 last frame
/:button[1] = true;

// button 1
if (/:button[1]) {
  // do something here
  // allow switch of module, etc
}

cheers
bioterror

ASKER
RP was very helpful.  I'm going to execute it this way...


- Very first frame (minor error from above, no biggie)

buttons = new Array();
buttons[1] = "no";
buttons[2] = "no";
buttons[3] = "no";
buttons[4] = "no";
buttons[5] = "no";
buttons[6] = "no";

- Put this code in for the buttons

on (release) {
    if (buttons[1] == "yes") {
        gotoAndStop("subject_1", 1);
    } else {
    }
}

True, this doesn't allow me to skip around, but I think it will be more appropriate for the end users in the long run.

Thank you so much!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
rascalpants

henry,

what does this mean:

/:module=2;

what is the /: before the variable?  that looks like Flash 4 code...


And yes, you don't have to set the initial value of the array, but I did so, just so the process whould easily be understood...


"True, this doesn't allow me to skip around, but I think it will be more appropriate for the end users in the long run."

as long as you set the button value to yes when the user completes the necessary action, then they can skip around all they want...  is that what you wanted?  


I gave you a very simple solution, so that you would be able to learn from it...


rp
henryww

hi rp,

/: my lazy way :) to do that instead of the dot notation

yes, rp's solution was clean and great for many modules & random access.

- Very first frame (minor error from above, no biggie)??
button(s)?? ar ... i think that's a typo...

btw, rp, so what's extra deals we get from EE?
pts for money? or what? LOL

cheers
rascalpants

I WISH, then I would just quit my normal job, and spend my entire time on the boards... as if I don't already do that anyway :)

You get some minor conveniences like Quicklinks(which I only use 4) and you get a ton of question points... you get a few links to Latest Asked/Answered Quesitons, which is where you can see exactly how many expert points you were awarded for each question...

I am sure there are other things, but I have not really explored these areas...


rp
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.