loop counter to variable name
i have 4 sprites named sprite1, sprite2, sprite3, , sprite4. each of them contains textfield called mytextfield. trying make loop following, syntax must wrong:
for (var i:uint=1; i<=4; i++) {
this["sprite"+i].mytextfield.text = i;
}
when run debugger "error #1010: term undefined , has no properties." can figure i'm doing wrong?
try using instead:
for (var i:uint=1; i<=4; i++) {
this.getchildbyname("sprite"+i).mytextfield.text = i;
}
and make sure sprites sit on level call from
More discussions in ActionScript 3
adobe
Comments
Post a Comment