Attach an actionscript to multiple buttons at once

I’m trying to find the way to attach the same actionscript to multiple
buttons(over 100 buttons) at one time, instead of copying and pasting
the actionscript in every frame. I have over 100 buttons as a seperate object in the library. In timeline, there are 100 keyframe, that each frame contains one button. Each instance is from one button. I don’t want to write a same actionscript in for every button object. Is there anyway to get
around that?

thank you in advance,
Nu

make your button names like myButton0,myButton1,myButton2,myButton3…
and than make a for loop like:

[AS]
for(i=0;i<100;i++){
_root[“myButton”+i].onRelease = function(){
// YOUR ACTINSCRIPT :wink:
}
}
[/AS]

Thank you very much for your answer.