PDA

View Full Version : FlashMX - Possible to make symbols an array?


LukeSimm
08-03-2007, 06:29 PM
Hello,

I was wondering if it's possible to make an array of a symbol in either FlashMX or Flash 8? Not sure if an Array is the techincal term though... For example, in Visuabl Basic it's possible to copy and paste a control and create something akin to cmdButton[1] and cmdButton[2], with the 1 and 2 being able to be chossen by code. (cmdButton[var])

Failing this, would it be possible in action script to refrence an object such as tile26 with something like tile[var] where var = 26?

--- Luke

CyanBlue
08-03-2007, 06:33 PM
Howdy and Welcome... :)

Assuming that the absolute path to the tile26 movieClip instance is _level0.tile26, you could use an array notation to access it like this...
id = 26;
_level0["tile" + id]._x = 100;
You could also do that array of movieClips idea like this...
movieClip_arr = new Array();
for (var i = 0 ; i < 100 ; i++)
{
movieClip_arr.push(_level0["tile" + i]);
}
movieClip_arr[26]._x = 100;