Recognizing true/false statement inside MC

How do you get a True/False statement to be recognized inside a movie clip with a button on the main timeline as the control. I want my movie clip to stop at the last frame if the movie clip reaches the last frame. Otherwise gotoAndStop at the first frame of the clip. I was using

on (press) {
_root.m1.gotoAndPlay(2);
_root.m2.gotoAndPlay(1);
_root.m3.gotoAndPlay(1);
_root.m4.gotoAndPlay(1);
_root.m5.gotoAndPlay(1);
}
on (release) {
if (_root.m1.nFlag = false)) {
gotoAndStop(1);
} else {
gotoAndStop(50);
}
}

if you copied and pasted the script… there are two errors in this line:

if (_root.m1.nFlag = false)) {

it should be

if (_root.m1.nFlag == false) {

:-\

I don’t think that is the problem.

on (press) {
_root.m1.gotoAndPlay(2);
_root.m2.gotoAndPlay(1);
_root.m3.gotoAndPlay(1);
_root.m4.gotoAndPlay(1);
_root.m5.gotoAndPlay(1);
}
on (release) {
if (nFlag == true) {
_root.m1.gotoAndStop(50);
nFlag = false;
} else {
_root.m1.gotoAndStop(1);
}
}

I want it to play the movie clip as long as the person holds it, and if it reaches the last keyframe, then it plays a clip, and the person can let go, but if they let go before it reaches the last key frame, it goes to the beginning and stops.

   What works:~: The false and the Else statement.

   What does not work:~: It is not recognizing the True Statement, When you click and hold the button, It plays the loader, but when you let go, it goes back to one(which i want) and then it plays(which i Don't want). When it goes to frame 50, it is supposed to stop, but it goes back and stops on 1.

Can you please help me with this script.

?

ehmm… attach you fla so i can see exactly what you’re talking about. :-\

Here’s the FLA you asked for.

sorry, here it is

in your last frame of the movieclip you have

nFlag == true

it should be

nFlag = true

and you can shorten your if statement to look like this:

on (release) {
	if (_root.m1.nFlag == false)
	{
		_root.m1.gotoAndStop (2);
	}
}

Thank you very much for the help, It works Great! Somebody has been trying to get this working for a long time, Thanks.:A+:

yeah attaching the file usually helps beacuse sometimes its just how you have it set up that can cause problems. Glad I could have helped.