For Loop Creation of new instance of Array in ActionScript 3 -
is there way create instances of array in loop?
here's code...
var recarrcon1:array = new array(50); var recarrcon2:array = new array(50); var recarrcon3:array = new array(50); var recarrcon4:array = new array(50); var recarrcon5:array = new array(50); var recarrcon6:array = new array(50); var recarrcon7:array = new array(50); var recarrcon8:array = new array(50);
i want make declaration in dynamic way loop. in advance.
by way, i'm using as3
edit: answer (from barış uşaklı):
var recarrcons:object = {}; for(var i:int=1; i<=8; i++) { recarrcons["recarrcon" + i] = new array(50); } trace(recarrcons.recarrcon4); // 4th array
make class containing code dynamic can create names dynamically.
for(var i:int=1; i<=8; i++) { this["recarrcon" + i] = new array(50); } trace(this.recarrcon4); // 4th array
or can store them in object
:
var recarrcons:object = {}; for(var i:int=1; i<=8; i++) { recarrcons["recarrcon" + i] = new array(50); } trace(recarrcons.recarrcon4); // 4th array
Comments
Post a Comment