Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

navigation - prevent user from skipping ahead

Posted on 2003-02-24
7
Medium Priority
?
202 Views
Last Modified: 2010-04-03
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.
0
Comment
Question by:bioterror
  • 3
  • 3
7 Comments
 
LVL 22

Accepted Solution

by:
rascalpants earned 200 total points
ID: 8011975
you should use an if...then statement on each button click to check to see if a variable is at the proper number...You will probably use an array to store the variables...

in your first frame you should set the initial value of the array...

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


something like this would work on each button:

on(release){
  for(i=0; i<5; i++){
    if(buttons[i] == "yes");
       this["_root.movieclip"+i].gotoAndPlay(1);
    }
  }
}


then when the user completes the task, set the button array value to "yes"


the above code is theory, and I have not created a working example...but it should all work properly...

let me know if you have any problems or questions...


rp


0
 
LVL 6

Expert Comment

by:henryww
ID: 8015797
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
0
 
LVL 6

Expert Comment

by:henryww
ID: 8015798
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
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:bioterror
ID: 8016539
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!
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8017733
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
0
 
LVL 6

Expert Comment

by:henryww
ID: 8018260
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
0
 
LVL 22

Expert Comment

by:rascalpants
ID: 8018391
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
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question