PDA

View Full Version : as3 is killing me slowly. quick for() question


calipoop
03-12-2008, 11:06 PM
I have three items I've placed on the stage: thumb1 thumb2 and thumb3. To assign button actions I'd previously use something like this in as2:


for(i = 1 ; i<=3 ; i++){
this["thumb"+i].onPress = function(){}
}


How would this be done in AS3? I know and understand that as3 uses addEventListener(MouseEvent.CLICK, onMouseClick); my question is how do you translate this["thumb"+i] in AS3

Thanks for helping me out!

SirDuke
03-12-2008, 11:36 PM
check this out: http://www.actionscript.org/forums/showthread.php3?t=163911

calipoop
03-13-2008, 12:51 AM
thank you sir duke. crisis averted. :cool: