# Simple VAR questions for Flash5

**URL:** <https://forum.kirupa.com/t/simple-var-questions-for-flash5/19054>\
**Category:** Uncategorized\
**Created:** [April 23, 2003, 9:24pm UTC](https://forum.kirupa.com/t/simple-var-questions-for-flash5/19054 "2003-04-23T21:24:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericinho](https://avatars.discourse-cdn.com/v4/letter/e/9dc877/32.png) [@ericinho](https://forum.kirupa.com/u/ericinho)\
**Post date:** [April 23, 2003, 9:24pm UTC](https://forum.kirupa.com/t/simple-var-questions-for-flash5/19054/1 "2003-04-23T21:24:07Z")

</div>

Ok, this is what I want to achieve:

on one page there are 6 invisible buttons. All have a AS like bwlow attached to them. The AS trigger one of 6 MC.  
The MC itself has three states:

frame 1: invisible  
frame 2: rollOver state  
frame 3: selected state when onRelease (on release also a var is being set as you can see)

it works, except that when one of the 6 MC’s are in Selected state, all others should remain in FRAME 1, so invisible and not clickable (in the selected mc there will be the opportunity to make the others active again and it will set the var back to empty).

I want to accomplish this by checking whenever I rollOver if the VAR is being set to one of the 6. If yes, onRollOver goes to play frame 1 of the MC - Invisible state.  
If not, the MC plays frame 2 - the rollOver state.

**But how do I check for all six VAR variables (so the 1,2,3,4,5,6)???**

(and obviously i have to change the rollOut part as well :whistle:

```auto
on (rollOver) {

**	if (_root.textMC.pdvar == "1,2,3,4,5,6") {
		_root.textMC.pd_p2_1.gotoAndPlay(1);
	} else {
		_root.textMC.pd_p2_1.gotoAndStop(2);
	}**
}
on (rollOut) {
	if (_root.textMC.pdvar ne "1") {
		_root.textMC.pd_p2_1.gotoAndStop(1);
	} else {
		_root.textMC.pd_p2_1.gotoAndStop(3);
	}
}
on (release) {
	_root.textMC.pdvar = "1";
	_root.textMC.pd_p2_1.gotoAndStop(3);
}

```

---

<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 24, 2003, 5:17am UTC](https://forum.kirupa.com/t/simple-var-questions-for-flash5/19054/2 "2003-04-24T05:17:12Z")

</div>

hmmm, perhaps not so simple 😉

---

<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 24, 2003, 3:15pm UTC](https://forum.kirupa.com/t/simple-var-questions-for-flash5/19054/3 "2003-04-24T15:15:08Z")

</div>

I’m a newpie to ActionScript, but I think you can’t do following:  
if (\_root.textMC.pdvar == “1,2,3,4,5,6”) …

What you can do is 2 things: Use a Switch statement or  
do this(easier):

if (\_root.textMC.pdvar \>=1 || \_root.textMC.pdvar \<=6)…  
“Assuming pdvar is a number value”.

If not do this:  
if (parseInt(\_root.textMC.pdvar) \>=1 || parseInt(\_root.textMC.pdvar) \<=6)…

---

<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 24, 2003, 9:06pm UTC](https://forum.kirupa.com/t/simple-var-questions-for-flash5/19054/4 "2003-04-24T21:06:33Z")

</div>

but don’t use ‘||’ (OR-statement) but ‘&&’ (AND-statement)

and maybe just set the var as a number instead of a string:

```auto

_root.textMC.pdvar = 1;

```

so without the quotes.

---

<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 24, 2003, 10:30pm UTC](https://forum.kirupa.com/t/simple-var-questions-for-flash5/19054/5 "2003-04-24T22:30:49Z")

</div>

Yes use the && operand instead of the ||. Great catch…

---

<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, 8:11am UTC](https://forum.kirupa.com/t/simple-var-questions-for-flash5/19054/6 "2003-04-25T08:11:08Z")

</div>

thanks all 🙂

---

<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 26, 2003, 10:45am UTC](https://forum.kirupa.com/t/simple-var-questions-for-flash5/19054/7 "2003-04-26T10:45:56Z")

</div>

No problem.
