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

flash actionscript : arrayName.push(Object); ?


supdun
2/13/2006 10:55:55 PM
I've been experimenting with arrays. See what datatypes I can add to an array.
Now I know arrays are very flexible when it comes to adding Strings, Numbers,
and Booleans to one array. My question, is it possible to instantiate an object
into the push'es paramaters? In other words can I add an instantiation, methods
or properties to a single array. My ultimate goal is to add buttons to this
array. When the array is updated, I would like for a loop to spit out the the x
an y's to have the buttons beside each other. Is it legal? Can I instantiate
objects in a push param (e.g. push(var objName:DataType = new DataType();)
abeall
2/13/2006 10:58:53 PM
Did you try it?

ar = ;
ar.push(new Object());
trace(ar);

Jeckyl
2/14/2006 12:00:00 AM
You can put anything into an array that you can put in a variable.

eg

arrayName.push(new DataType());
--
Jeckyl

supdun
2/14/2006 3:34:47 PM
I'm such an idiot! It works great.

AddThis Social Bookmark Button