6 Jul 2009 21:44
how to classes as dynamic names
Hi
I have a class named "pul" and i have created some instances like that :
<pul name="pul1" /><pul name="pul2" /><pul name="pul3" /><pul name="pul4" />
in a method, i want to use these objects whose names should be specified with the i variable in a for expression
i.e. :
for (var i=0; i<4; i++) {
var temp= i+1;
'pul'+(temp.toString()).
setPulPosition(x,y);
}
But with this use, it is incorrect. Bec. 'pul'+(temp.toString()) is a String and i need "pul" object to use the appropriate method, i know the problem but i i have no idea how to do that.
Any idea?
Best regards.
}
But with this use, it is incorrect. Bec. 'pul'+(temp.toString()) is a String and i need "pul" object to use the appropriate method, i know the problem but i i have no idea how to do that.
Any idea?
Best regards.
--
Cem SONMEZ
RSS Feed