Store your buttons in an array

then for loop through the array

If you have instances of them on stage already and are not creating them
dynamically then its a little more work but u could still pass a reference
of each button into the array

greg

On Fri, May 1, 2009 at 12:10 PM, <zu...@zadesigns.com> wrote:

>
>
> Is there a better way to write Event Listeners for a large number of
> buttons that increment the names by 1? example:
> solution_button1.addEventListener(MouseEvent.MOUSE_DOWN, s_btn1_down);
> solution_button2.addEventListener(MouseEvent.MOUSE_DOWN, s_btn2_down);
> solution_button3.addEventListener(MouseEvent.MOUSE_DOWN, s_btn3_down);
> solution_button4.addEventListener(MouseEvent.MOUSE_DOWN, s_btn4_down);
> solution_button5.addEventListener(MouseEvent.MOUSE_DOWN, s_btn5_down);
> solution_button6.addEventListener(MouseEvent.MOUSE_DOWN, s_btn6_down);
> solution_button7.addEventListener(MouseEvent.MOUSE_DOWN, s_btn7_down);
> solution_button8.addEventListener(MouseEvent.MOUSE_DOWN, s_btn8_down);
> solution_button9.addEventListener(MouseEvent.MOUSE_DOWN, s_btn9_down);
>
>  can the above be accomplished with a for loop? what about more than one
> event over, out, down, click. can those also be automated or would I need 4
> loops for that.
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to