# Var Trouble

**URL:** https://forum.kirupa.com/t/var-trouble/64099
**Category:** flash
**Created:** [September 13, 2004, 8:50am UTC](https://forum.kirupa.com/t/var-trouble/64099 "2004-09-13T08:50:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![headznet](https://avatars.discourse-cdn.com/v4/letter/h/34f0e0/32.png) [@headznet](https://forum.kirupa.com/u/headznet)
#### Post date: [September 13, 2004, 8:50am UTC](https://forum.kirupa.com/t/var-trouble/64099/1 "2004-09-13T08:50:57Z")

</div>

How do you make a variable have multiple answers attached to it?

example:

workPages = page2\_mc, page5\_mc, page6\_mc, page7\_mc

I tried this but it only used page2\_mc and an array didn’t work.

---

<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 13, 2004, 12:38pm UTC](https://forum.kirupa.com/t/var-trouble/64099/2 "2004-09-13T12:38:09Z")

</div>

try:

```auto

var newVariable = new Array("Value1","Value2","Value3","Value4","Value5","Value6")

for(i=0; i<newVariable.length;i++){
  *do something with* newVariable*
}

```

---

<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 13, 2004, 6:02pm UTC](https://forum.kirupa.com/t/var-trouble/64099/3 "2004-09-13T18:02:17Z")

</div>

I am trying to make the script run like this:

workPages = page2\_mc, page5\_mc, page6\_mc, page7\_mc  
if (currentPage == workPages){  
do this  
}

How would I set up a FOR LOOP to achieve this. Sorry about the question I am still a n00b.

---

<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 13, 2004, 8:07pm UTC](https://forum.kirupa.com/t/var-trouble/64099/4 "2004-09-13T20:07:27Z")

</div>

something like this:

```auto

workpages = new Array("Page2","Page3","Page5");
currentpage = "Page3";
for (x in workpages) {
if (currentpage == workpages[x]){
trace ("done that with "+workpages[x]);
}
}

```

Note that currentpage can hold only a value though. If you want multiple pages in the currentpage variable (array 😉 ) you need one more loop.
