?
Solved

navigation - prevent user from skipping ahead

Posted on 2003-02-24
7
Medium Priority
?
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

800 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