actionscript 3 - Dynamically calling array value by index number -


i'm having trouble calling values of array using index number dynamically. i'm trying name of movieclip dynamically each time loop calls. code:

public var allitemsunlockedtc:array = new array("itemwrench", "itemsc", "itemvoltmeter", "itemgloves", "itemstirespray");  for(var tcitems:int = 0; tcitems < allitemsunlockedtc.length; tcitems++)             {                 trace("tcitems length: " + tcitems);                 trace("values: " + allitemsunlockedtc.valueof([tcitems]));                 /*getchildbyname(allitemsunlockedtc.valueof(tcitems) movieclip).x = par.toolcloset.kast_1.slottc1;//getchildbyname("slottc" + (tcitems + 1)).x + 400;                 getchildbyname(allitemsunlockedtc.valueof(tcitems) movieclip).y = par.toolcloset.kast_1.slottc1;//getchildbyname("slottc" + (tcitems + 1)).y + 245;                 getchildbyname(allitemsunlockedtc.valueof(tcitems) movieclip).gotoandstop(2);                 //getchildbyname(allitemsunlockedtc.valueof(tcitems)).name = ("slottc" + (tcitems + 1));                 notinventoryparenttc.addchild(getchildbyname(allitemsunlockedtc.valueof(tcitems) movieclip));*/             } 

instead of getting values 1 one in ascending order, values @ once every time loop calls.

how call value index using loop ?

thanks in advance,

milan

nevermind, solved it.

trace("values: " + allitemsunlockedtc[tcitems]); 

stupid question xs

you want item @ specific index. in actionscript done this: yourarray[index]. don't use valueof.

so like:

trace("values: " + allitemsunlockedtc[tcitems]); 

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 -