# Array Buttons and Event Handler

**URL:** https://forum.kirupa.com/t/array-buttons-and-event-handler/247106
**Category:** flash
**Created:** [December 18, 2007, 4:42pm UTC](https://forum.kirupa.com/t/array-buttons-and-event-handler/247106 "2007-12-18T16:42:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![snozbunny](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@snozbunny](https://forum.kirupa.com/u/snozbunny)
#### Post date: [December 18, 2007, 4:42pm UTC](https://forum.kirupa.com/t/array-buttons-and-event-handler/247106/1 "2007-12-18T16:42:07Z")

</div>

I’m cleaning up my code and I decided to try my hand at using an array for buttons but when I try to assign an event listener I can’t figure out a way to call different functions without starting another array or making more redundant code. I’m sure there’s a simpler way to do this. Any suggestions?

```php
.

            _test[0] = _buttonsItem.ffBtn;
            _test[1] = _buttonsItem.pauseBtn;
            _test[2] = _buttonsItem.playBtn;
            _test[3] = _buttonsItem.rewindBtn;
            _test[4] = _buttonsItem.soundBtn;
            _test[5] = _buttonsItem.stopBtn;
            _test[6] = _videoBackg;

            for (var i=0;i<_test.length;i++){
                _test*.buttonMode=true;
                _test*.addEventListener(MouseEvent.CLICK,#### Some kind of dynamic _test* function calling ####);
            }

.

```

I’m new to AS3 so please be patient if this seems like an obvious solution.
