If you made the button as a movieclip instead of a button, you could put the script inside the button. It would be something like this:
If you wanted to sow the user a pressed state for a moment, you could have two frames, the second one look like a pressed version of the graphic Then this would be the whole script, which you would put into frame 1 of the movieclip:
If the code is on its on layer and there are no key frames, the code will always work, right?
Pretty sure that even if code is on a layer with other things, and there are keyframes after it, it should still work. The advantage of putting the code in the movielcip itself would be that you can put a copy of the button in to just the places it's needed, without having to add code to the timeline for each case.