Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | Re: [flasher] array name as a variable |
From: | Helen Triolo |
Date: | Tue, 13 Feb 2001 03:45:28 -0000 |
Hi Virgil,
Yes, if your array specifier is a string (x="fish" instead of x=fish).
Every object in Flash has an (associative) array that points to all of
the objects within it (including variables), each of which can be
accessed with the object's name. So you can do it like this for
example:
fish = new array(13, 27, 39, 41, 43);
x = 3;
item_array = "fish";
trace(_root[item_array][x]);
--> returns 41
(item_array is in the root object, so _root[item_array] = _root["fish"]
= array fish, and so _root[item_array][x] = fish[x] = fish[3] = 41)
hth,
Helen
-----------------------------------------------------
i-Technica � http://i-technica.com � 301.424.6037
developer resources: http://i-technica.com/whitestuff
Virgil Carroll wrote:
>
> Group,
>
> Is there a way to have an array name set as a variable. Say for instance
> that I want to set-up an array.
>
> Fish = new Array (12);
>
> Now I have other arrays that I may need information from as well. Based
> upon the users input I need to pull the information from the correct array.
> So if I use the formula:
>
> X=10
> Item_array = Fish
>
> Item_value = Item_array (x); It does not work.
>
> Any ideas if this is possible. I have not been able to get it to work. Any
> help is greatly appreciated.
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]