February 25th, 2012, 09:12 AM
Creating 10 functions using for loop?
I am trying to create functions using a for loop for my buttons' over and out listeners.
I would like to stick to a naming convention but it does not seem to work. I am trying to create 10 buttons with function names like btnOver1, btnOver2, etc...
I am getting a syntax error: expecting leftparen before leftbracket
February 27th, 2012, 09:43 AM
for(var i:int = 0; i < 10; i++)
this.getChildByName("btn_mc" + i).addEventListener(MouseEvent.ROLL_OVER, this.doButtonOver);
Quis custodiet ipsos custodes?