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

Complex Navigation for the confused ! 2

Status
Not open for further replies.

simonWMC

Programmer
Dec 2, 2002
180
GB
Hello all, I have an interesting problem

I have a frame with three secret buttons. Each button leads to another frame, which has a video clip on it. After the video clip the user is asked a question. After they have answered the question i want them to back to the page with the three buttons and choose another option.

I want them to have to follow all three buttons and answer all three questions.

My question is this =

how do i track what they have done, and not allow them to progress unless they have completed all three questions ?

my brain hurts now !

simon
 
Just use variables and condition further navigation to those variables being "true".

To start with...

_level0.question1 = false;
_level0.question2 = false;
_level0.question3 = false;

Than as each question is answered (or even onlty if answered correctly) set the question variable to "true".

_level0.question1 = true;
Etc...

Then on your navigation frame...

if (_level0.question1 == "true" && _level0.question2 == "true" && _level0.question3 == "true"){
// script to allow further navigation
} else {
// other script if condition is not met
}

Regards,

oldman3.gif


Don't worry, if my reply is wrong, BillWatson will clean it up for me!
 
Thanx for that. I can see that it should work, but alas i must be doing something wrong.

I am declaring the variables
_level0.question1 = false;
_level0.question2 = false;
_level0.question3 = false;
in the first frame

Then on each button i change them to true on release.

Then on the button to continue to the next frame i have
if(_level0.question1== "true"&&_level0.question2=="true"&& _level0.question3=="true") {
}
on (release) {
gotoAndPlay("Scene 2", 3);
} else {
tellTarget ("NYMC") {
_x = 346.4;
_y = 229.9;
gotoAndPlay(2);
}
}

What am i doing wrong ????

thanx again
 
You've got nothing between the braces on the first line.

if(_level0.question1== "true"&&_level0.question2=="true"&& _level0.question3=="true") {
}

... this should wrap around the rest of the code.

on (release) {
if(_level0.question1== "true"&&_level0.question2=="true"&& _level0.question3=="true") {
gotoAndPlay("Scene 2", 3);}
} else {
tellTarget ("NYMC") {
_x = 346.4;
_y = 229.9;
gotoAndPlay(2);
}
}

Depending on how your movie is structured you could probably loose the references to '_level0' too which isn't a great way to reference variables.

If you still have problems with this not working check on the gotoAndPlay statements, they might need to point to a different timeline if your button is inside a movieclip...
 
yeah, ooooppss. I did notice that and put the on (release){ on the first line.
So i have put that right, but still get this error :

Scene=Scene 2, Layer=Nav, Frame=3: Line 4: 'else' encountered without matching 'if'
} else {

The only gotoAndPlay is to the very next frame on the timeline. I only put the "scene 2" when trying to fix it.

 
I didn't actually pay attention to the code, just cut and pasted - this will fix the error:

on (release) {
if (_level0.question1 == "true" && _level0.question2 == "true" && _level0.question3 == "true") {
gotoAndPlay("Scene 2", 3);
} else {
tellTarget ("NYMC") {
_x = 346.4;
_y = 229.9;
gotoAndPlay(2);
}
}
}
 
thankyou - works a treat !!!

so simple when you look back !

simon
 
Shessssssssh! Regards,

oldman3.gif


Don't worry, if my reply is wrong, BillWatson will clean it up for me!
 
of course thanx to you too oldnewbie - but thought i had said that already.
 
Hello again

I am still having problems with this.

I have set the variables at the beginning of the timeline. I have also changed these when each button is pressed. I know this bit is working as i have traced them in the output window. However, the if statement still does not work, it goes straight to the else. My code is as below

on (release) {
if (_root.question1 == "true" && _root.question2 == "true" && _root.question3 == "true") {
gotoAndPlay("Scene 3", 1);
} else {
tellTarget ("NYMC1") {
_x = 350;
_y = 360;
gotoAndPlay(2);
}
}
}


All variables are set to true when the button is released - what am i doing wrong ????

thanx in advance
 
on (release) {
if (_root.question1 == true && _root.question2 == true && _root.question3 == true) {
gotoAndPlay("Scene 3", 1);
} else {
tellTarget ("NYMC1") {
_x = 350;
_y = 360;
gotoAndPlay(2);
}
}
}
true is not text but a boolean value so no ""
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top