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

if else statements... 1

Status
Not open for further replies.

simonWMC2

Programmer
Aug 5, 2004
161
GB
Hi

I have a page with a .continue' button on it. There are also two buttons (that sit inside a movie clip)that i want the user to click before they continue. On the actions layer i have set three variables
Code:
_root.cp = false;
_root.rela = false;
_root.pro = false;
The two buttons (cp & rela) display some dynamic text and also set the variables accordingly:
Code:
on(release) {
	_root.cp = true ;
	CPR_text.text = "text here.";
}

If the user tries to click the 'continue' button before clicking the two buttons in the movie clip, another movie clip plays which tells them to clcik both buttons. If they have clicked both buttons, then a third movie clip plays when they click the 'continue' button.

All this works fine - HOWEVER, once the third movie clip has played I want the user to click the continue button again to move to the next page. To do this i put this on the last frame of the third move clip
Code:
_root.pro == true;
stop();

The code to make all this work is attached to the 'continue' button

Code:
on (release) {
	if (_root.cp == false || _root.rela == false) {
		warning.play(2);
	} else if (_root.cp == true && _root.rela == true) {
		process.play(2);
	} else if (_root.pro == true) {
		nextFrame();
	}
}

OK - the problem is that it nevr goes to the nextFrame() action. Even if the pro variable is set to true it doesn't work. Can any one help ? sorry this is so long....
 
If I understood you correctly, I think your if/else statement should be like this:
[tt]
on (release) {
if (!_root.cp || !_root.rela) {
warning.play(2);
} else {
if (_root.pro) {
_root.nextFrame();
} else {
process.play(2);
}
}
}
[/tt]

Kenneth Kawamoto
 
Thankyou...

It is the same as before....

i wonder if the problem is not the if else statement and is something else ?
 
Put a trace() in to see what you're getting:
[tt]
on (release) {
if (!_root.cp || !_root.rela) {
warning.play(2);
} else {
trace("_root.pro: "+_root.pro);
if (_root.pro) {
_root.nextFrame();
} else {
process.play(2);
}
}
}
[/tt]

Kenneth Kawamoto
 
pro isn't getting changed to true...

I have got
Code:
_root.pro == true;
stop();

on the asctions layer in the last frame (also tried on second frame) of the third movie clip.

I'm not sure what it isn't changing to true...
 
Well I don't know why either but you can always put it in your button action:
[tt]
on (release) {
if (!_root.cp || !_root.rela) {
warning.play(2);
} else {
trace("_root.pro: "+_root.pro);
if (_root.pro) {
_root.nextFrame();
} else {
_root.pro = true;
process.play(2);
}
}
}
[/tt]

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top