# Multiple button scripts in one layer, is it possible?

**URL:** <https://forum.kirupa.com/t/multiple-button-scripts-in-one-layer-is-it-possible/92039>\
**Category:** Uncategorized\
**Created:** [October 12, 2003, 12:55pm UTC](https://forum.kirupa.com/t/multiple-button-scripts-in-one-layer-is-it-possible/92039 "2003-10-12T12:55:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trevorsaint](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/trevorsaint/32/268_2.png) [@trevorsaint](https://forum.kirupa.com/u/trevorsaint)\
**Post date:** [October 12, 2003, 12:55pm UTC](https://forum.kirupa.com/t/multiple-button-scripts-in-one-layer-is-it-possible/92039/1 "2003-10-12T12:55:33Z")

</div>

Is there anyway you can have multiple scripts in once action script layer. The reason I ask is that I have multiple buttons, and rather than creating five different action layers, I would rather reduce the layer count and place this in a single action script layer, for example - I am using the following for my buttons :

[AS]

buttonOne.onRollOver = function(){  
OK1 = true;  
}  
buttonOne.onRollOut = function(){  
OK1 = false;  
}  
effectOne.onEnterFrame = function() {  
if (OK1) {  
effectOne.nextFrame();  
} else {  
effectOne.prevFrame();  
}  
};

[/AS]

I would then need to create a second layer for the second button, adjusting the code slightly to suit the buttons etc, is there a method of doing this?, and you cannot simply copy the code after, as this causes problems

please

if you know let me know 🙂

thanks
