Theres any way to put actionscript on a button on the library?

Hello
i have 6 buttons on my library. and i have that 6 buttons on my timeline repeated in 30 frames…
theres anyway to put code on all buttons at the same time? something like put the code on the library and aply to all on the timeline?

Thanks