Flash actionscript 3.0: Dynamic Array in AS3

Dynamic Array in AS3

Posted by Sankar.G | Posted in | Posted on 10:23 PM

we create a dynamic Array easily in as2 but in as3 it is little bit difficult below script is useful to Create a dynamic Array

for that we first declare a object and in the Object we create a 'n' numbers of Array

var vbox:Array
var dArray:Object = new Object();
var counter:int = 1;
var i:Number;
for (i=1;i<=5;i++)
{
vbox = new Array(1,2,3,4);
dArray[("vb" + counter)] = vbox;
counter++;
}

dArray[("vb"+1)][1]=985;

for(i=1;i<=5;i++)
{
trace(dArray[("vb"+i)]);
}

Comments (1)

You are amazing!!


Thank you for this! You've just put my as3 life at ease.

I know how dynamic works but I only knew it on C terms. And let's face it, C is almost nonexistent, aside for the fact that it's the foundation of programming.

Anyway, thank you once again! I'll be checking your blog now and then.