# \[Flash 8\] Help with code efficiency

**URL:** <https://forum.kirupa.com/t/flash-8-help-with-code-efficiency/170595>\
**Category:** flash\
**Created:** [November 27, 2005, 11:52pm UTC](https://forum.kirupa.com/t/flash-8-help-with-code-efficiency/170595 "2005-11-27T23:52:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tjonmage](https://avatars.discourse-cdn.com/v4/letter/t/51bf81/32.png) [@tjonmage](https://forum.kirupa.com/u/tjonmage)\
**Post date:** [November 27, 2005, 11:52pm UTC](https://forum.kirupa.com/t/flash-8-help-with-code-efficiency/170595/1 "2005-11-27T23:52:56Z")

</div>

I know how to write loops to make my variable code short and efficient, but is there some way to to the same with code for buttons?

I have a quiz with 50 buttons, and the code for the buttons is written in the first frame along with the rest of the script:

```auto
button1.onRelease = function() {
this._parent.answer(1);
};
button2.onRelease = function() {
this._parent.answer(2);
};
button3.onRelease = function() {
this._parent.answer(3);
};
 
//And so on until 
 
button50.onRelease = function() {
this._parent.answer(50);
};

```

This takes up more lines than half of the whole script, and seems unnecessarily bulky.

If anyone has any thoughts on how to minimize the amount of code for this, I would be very thankful.
