arrays - In Actionscript 3, how to create many instances of the same symbol? -


though coding, must make many copies of same movieclip placed on stage, each manipulated code-wise on own

for instance, have movieclip named mc , wish have 99 copies of ít loaded onto stage, each in different x coordinate. should do?

i think on doing this:

step 1: in library, turning mc class

step 2: placing following code in scene's script

var myarray:array = new array  (var i:int = 0; i<99;i++) { var mcinstance:mc = new mc mc instance = myarray[i] movieclip.(myarray[i]).x = i*30 } 

would make sense?

that's right idea, syntax little off. try this:

var myarray:array = [];  (var i:int = 0; < 99;i++) {     var mc:mc = new mc();     myarray[i] = mc;     mc.x = * 30 } 

as3 style conventions: use lowercamelcase variable names, don't omit constructor parens though optional, , create arrays using literals (source).


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -