Var Trouble

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.

try:


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

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

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.

something like this:


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 :wink: ) you need one more loop.