# If condition without getting the else to function

**URL:** <https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882>\
**Category:** Uncategorized\
**Created:** [September 30, 2004, 9:38am UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882 "2004-09-30T09:38:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![clwright\_2000](https://avatars.discourse-cdn.com/v4/letter/c/b2d939/32.png) [@clwright\_2000](https://forum.kirupa.com/u/clwright_2000)\
**Post date:** [September 30, 2004, 9:38am UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/1 "2004-09-30T09:38:32Z")

</div>

:hugegrin: Hi,

Im using the following to display feedback once a check answer button is clicked to see if the correct object out of four has been selected.

It works as far as displaying the tick - once the correct object is selected but im unable to get the cross to display when the wrong choice is made (ie any other object than the correct one).

Would really be greatful if someone could help me out…

* * *

on (release) {

if (\_root.choose1.\_visible == false) {  
if (\_root.choose2.\_visible == true) {  
if (\_root.choose3.\_visible == false) {   
if (\_root.choose4.\_visible == false) {

\_root.tick.\_visible = true;

```
} else if (_root.choose2._visible == false)	{					

```

\_root.cross.\_visible = true;

```
			}
		}
	}
}	

```

}

* * *

Cheers,

Clest

---

<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:** [September 30, 2004, 12:55pm UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/2 "2004-09-30T12:55:37Z")

</div>

Would this work??

on (release) {

if (\_root.choose1.\_visible == false) {  
\_root.tick.\_visible = true;  
} else if (\_root.choose2.\_visible == true) {  
\_root.tick.\_visible = true;  
} else if (\_root.choose3.\_visible == false) {  
\_root.tick.\_visible = true;  
} else if (\_root.choose4.\_visible == false) {  
\_root.tick.\_visible = true;

} else if (\_root.choose2.\_visible == false) {  
\_root.cross.\_visible = true;  
}

---

<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:** [September 30, 2004, 1:24pm UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/3 "2004-09-30T13:24:33Z")

</div>

Gave it a go but the tick was displayed for everyone I selected. I think the problem is that 2 needs to be selected exclusivly for it to give correct feedback.

Will play with the idea you suggested though… thanks for your help

---

<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:** [September 30, 2004, 1:30pm UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/4 "2004-09-30T13:30:19Z")

</div>

on (release) {

if (\_root.choose2.\_visible == false) {  
\_root.cross.\_visible = true;  
} else if (\_root.choose2.\_visible == true) {  
\_root.tick.\_visible = true;  
}  
}

This worked but not exclusivly… ie with both choose2 (correct) & choose3 (incorrect) selected it still displayed the tick :upset:

Any help appreciated :p:

---

<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:** [September 30, 2004, 1:45pm UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/5 "2004-09-30T13:45:35Z")

</div>

I’m not really understanding what you’re trying to do. My last suggestion was kinda a shot in the dark. If you can post your .fla file, I bet we’ll get 'er figured out in no time.

---

<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:** [September 30, 2004, 2:32pm UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/6 "2004-09-30T14:32:02Z")

</div>

That would be great… also what would be the best way to reset it??? :beam:

---

<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:** [September 30, 2004, 5:07pm UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/7 "2004-09-30T17:07:02Z")

</div>

put this on your check button

```auto

on (release) {
	if (_root.choose2._visible && !_root.choose1._visible && !_root.choose3._visible && !_root.choose4._visible) {
		_root.tick._visible = true;
		_root.cross._visible = false;
	} else {
		_root.tick._visible = false;
		_root.cross._visible = true;
	}
}

```

---

<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:** [October 1, 2004, 8:08am UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/8 "2004-10-01T08:08:20Z")

</div>

Like a dream!!! Thank you very much… may be pushing my luck here but was hoping you could let me know what code would go in a button to reset it???

:hugegrin:

---

<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:** [October 1, 2004, 10:17am UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/9 "2004-10-01T10:17:48Z")

</div>

If resetting means putting all to invisible… then… here you go 🙂

```auto

on(release) {
         for (i=1;i<=4;i++){
               _root["choose"+i]._visible = false;
         }
             _root.tick._visible = false;
	_root.cross._visible = 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:** [October 1, 2004, 11:46am UTC](https://forum.kirupa.com/t/if-condition-without-getting-the-else-to-function/65882/10 "2004-10-01T11:46:53Z")

</div>

Yep setting everything to its original state is what I needed to do… your solution is superb!

Out of curiosity though is that the easiest way?? I assumed that Flash would have some built in refresh/reset function that would be universal……. (kinda the equivalent of jumping to a new scene & jumping back…

Anyhow again thank you’ve been a great help ‘n’ have a great weekend :p:

Clest
