Groups | Blog | Home
all groups > flash actionscript > december 2005 >

flash actionscript : Can reference long array name with short variable?


MarkSLC
12/8/2005 9:55:28 PM
I can pull out information from an associative array with code similar to the
following ('i' equals 0, let's say):

trace(really_long_array_name[ i ].ID);

My question -- is it possible to create a brief form of that array prefix
through some sort of variable? It would make my code much more compact if I
could pull the data out with code similar to:

trace(v.ID + " " + v.Name + " " + v.Address);
--- as opposed to ---
trace(really_long_array_name[ i ].ID + " " + really_long_array_name[ i ].Name
+ " " + really_long_array_name[ i ].Address);

Tried creating String variables for that prefix, but that doesn't work. Thanks.

NSurveyor
12/8/2005 9:59:46 PM
Store really_long_array_name[ i ] in a local variable, for example:

v = really_long_array_name[ i ];
MarkSLC
12/8/2005 10:43:45 PM
NSurveyor
12/8/2005 10:56:20 PM
AddThis Social Bookmark Button