Groups | Blog | Home
all groups > flash actionscript > february 2004 >

flash actionscript : Access an array with variables from mc


Canbrit1000
2/20/2004 7:35:57 PM
How do I access an array in the root directory from a movie clip and use
variables?
If I use _root.myArray[2]=9 or var num=_root.myArray[2] it works but I want
to use a variable instead of the 2.
The problem is with trying to use [ ]
set("_root.myArray["+i+"]",9) or var num=["_root.myArray["+i+"]"] don't do it.

Any ideas please.
Dinghus
2/20/2004 7:50:29 PM
How about just doing something simple like this .

myVar = 2
_root.myArray[myVar]=9;

Canbrit1000
2/20/2004 8:01:27 PM
Thank you so much.
I see I have been overcomplicating things as usual. Didn't realize it would take a variable without special treatment *lol*
AddThis Social Bookmark Button