PDA

View Full Version : recognizing true/false statement inside MC



cybergold
April 25th, 2003, 01:26 PM
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);
}
}

kode
April 25th, 2003, 01:35 PM
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) {
:-\

cybergold
April 28th, 2003, 12:26 PM
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.

cybergold
April 28th, 2003, 01:21 PM
?

kode
April 28th, 2003, 01:57 PM
ehmm... attach you fla so i can see exactly what you're talking about. :-\

cybergold
April 30th, 2003, 12:58 PM
Here's the FLA you asked for.

cybergold
April 30th, 2003, 01:50 PM
sorry, here it is

Jubba
April 30th, 2003, 02:03 PM
in your last frame of the movieclip you have
nFlag == true
it should be
nFlag = trueand you can shorten your if statement to look like this:
on (release) {
if (_root.m1.nFlag == false)
{
_root.m1.gotoAndStop (2);
}
}

cybergold
April 30th, 2003, 03:13 PM
Thank you very much for the help, It works Great! Somebody has been trying to get this working for a long time, Thanks.:A+:

Jubba
April 30th, 2003, 03:52 PM
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.