creating new variable name instance using this[ ] in actionscript 3 -


i keep looking on internet think, far have searched, nothing yet had been posted (if any, please give me links). way make instance way. when tried, there's compilation error, syntax error ("expecting identifier before this"). i'm happy receive guys.

here's code.

var mc_names:array = [];  function createmovieclip(index:int):void{     var nameofmc:string = "mc_" + index;     mc_names[index] = nameofmc;     var this[mc_names[index]]:movieclip = new movieclip();       **// i'm asking if possible**     this[mc_names[index]].graphics.linestyle(20,0x00ff00, 0.5);     this[mc_names[index]].graphics.moveto(square_mc.x,square_mc.y);     this[mc_names[index]].graphics.lineto(mc3.x, mc3.y);     this[mc_names[index]].x = 0;     this[mc_names[index]].y = 0;     addchildat(this[mc_names[index]], 0);     currentindex++; } 

or there way make more simple or way of declaring variable instances through this[] make dynamic creation of movieclip instances.

var index:int = 1; var a:array = new array(); a[index] = "mc_1"; a[index] = new movieclip(); a[index].graphics.linestyle(20,0x00ff00, 0.5); a[index].graphics.moveto(0,0); a[index].graphics.lineto(100, 100); a[index].x = 0; a[index].y = 0; addchildat(a[index], 0); 

//it possible way. direct substitution... :d


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -