Link to home
Start Free TrialLog in
Avatar of ErnstJacobs
ErnstJacobsFlag for Germany

asked on

Flash - loop

I've got
ButtonOne.addEventListener(MouseEvent.MOUSE_OVER,ButtonOneOver);

Open in new window


The problem is that I need 6 of the same, only the "ButtonOne and ButtonOneOver" need to change to ButtonTwo and ButtonTwoOver and so on..

please help :)

Avatar of deepanjandas
deepanjandas
Flag of India image

Try this:
for( var i:int=6; i<6; i++){
     var buttonName:String = "ButtonOne";
     var button:* = getChildByName( buttonName );
     var functionName:String = buttonName.concat("Over");
     button.addEventListener(MouseEvent.MOUSE_OVER, this[functionName]);
}

Open in new window


Warm Regards
Deepanjan Das
ASKER CERTIFIED SOLUTION
Avatar of smabudhahir
smabudhahir

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ErnstJacobs

ASKER

Got yours working, it was pretty easy :) Thank you