# Recognizing true/false statement inside MC

**URL:** <https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242>\
**Category:** Uncategorized\
**Created:** [April 25, 2003, 5:26pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242 "2003-04-25T17:26:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![cybergold](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cybergold](https://forum.kirupa.com/u/cybergold)\
**Post date:** [April 25, 2003, 5:26pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/1 "2003-04-25T17:26:42Z")

</div>

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);  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 25, 2003, 5:35pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/2 "2003-04-25T17:35:01Z")

</div>

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

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

```

it should be

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

```

:-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 28, 2003, 4:26pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/3 "2003-04-28T16:26:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 28, 2003, 5:21pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/4 "2003-04-28T17:21:34Z")

</div>

?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 28, 2003, 5:57pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/5 "2003-04-28T17:57:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 30, 2003, 4:58pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/6 "2003-04-30T16:58:12Z")

</div>

Here’s the FLA you asked for.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 30, 2003, 5:50pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/7 "2003-04-30T17:50:00Z")

</div>

sorry, here it is

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 30, 2003, 6:03pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/8 "2003-04-30T18:03:35Z")

</div>

in your last frame of the movieclip you have

```auto
nFlag == true

```

it should be

```auto
nFlag = true

```

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

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 30, 2003, 7:13pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/9 "2003-04-30T19:13:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 30, 2003, 7:52pm UTC](https://forum.kirupa.com/t/recognizing-true-false-statement-inside-mc/19242/10 "2003-04-30T19:52:12Z")

</div>

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.
