# Simple trouble with array

**URL:** <https://forum.kirupa.com/t/simple-trouble-with-array/28831>\
**Category:** Uncategorized\
**Created:** [August 19, 2003, 2:42am UTC](https://forum.kirupa.com/t/simple-trouble-with-array/28831 "2003-08-19T02:42:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [August 19, 2003, 2:42am UTC](https://forum.kirupa.com/t/simple-trouble-with-array/28831/1 "2003-08-19T02:42:21Z")

</div>

Howdy all - been away for awhile (the joys of the real job) but now back to it with a question that I think may be related to my simple array.

I have several symbols in an array. I have several buttons on the page. When I roll over the button I want all the symbols to be invisible and then I want to make one symbol visible (array.\_visible = 0; symbol1.\_visible = 1). I put this same code on every button but, obviously, changing the one symbol to be visible to correspond to that button.

So here is my problem - it works great for some buttons, but not for others. Seems like there are a few that, once I roll over them, the symbol stays no matter which button is next hit. Is there some kind of obvious thing I am overlooking? :sure:

Thanks for any 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:** [August 19, 2003, 3:56am UTC](https://forum.kirupa.com/t/simple-trouble-with-array/28831/2 "2003-08-19T03:56:35Z")

</div>

here’s what you can do:

for each button, have an action that sets a common (one) variable that corresponds uniquely to each button (an ID, if you will). Then onRollOver, set that common var to the rolled-over button’s ID and at the same time check to see if the common var matches its own ID, if not, fade or whatever.

do you get it?

---

<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:** [August 19, 2003, 4:40am UTC](https://forum.kirupa.com/t/simple-trouble-with-array/28831/3 "2003-08-19T04:40:07Z")

</div>

uh, not totally. But thanks for responding so quickly! Maybe you could elaborate a little or give an example?

Thanks . . .

---

<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:** [August 19, 2003, 5:07am UTC](https://forum.kirupa.com/t/simple-trouble-with-array/28831/4 "2003-08-19T05:07:07Z")

</div>

um, ok…here’s some pseudo code:

```auto
on (rollOver) {
_root.rolledoverbutton = this;
if (_root.rolledoverbutton != this) {
this._visible = false;
}
}
on (rollOut) {
this._visible = true;
}

```

Something to that nature. You follow?

---

<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:** [August 19, 2003, 5:04pm UTC](https://forum.kirupa.com/t/simple-trouble-with-array/28831/5 "2003-08-19T17:04:21Z")

</div>

Hey thanks! I have a question though. How would I make a particular movie clip become visible when the button is rolled over? And at the same time make all the other movie clips become NOT visible?

Could I say:

[AS]  
on (rollOver) {  
\_root.rolledoverbutton1 = this;  
if (\_root.rolledoverbutton1 != this) {  
MC1.\_visible = true;  
[array of other MCs].\_visible = false;  
}  
}  
[/AS]

Thanks again for any help!
