Disable button if on a frame

Hi,

I have created a series of buttons which are actually MCs in AS3. Each button when clicked goes to a particular frame (all good). The problem that occurs is when you click a button that is ‘active’ (ie click a button twice in a row)…Flash takes you to the next frame rather than keeping you on the designated frame.

How can I stop this or disable the button whilst on its designated frame?

if(mymovieClip.currentFrame == 'myFrame') {

DONT DO ANYTHING!

} else {
gotoAndPlay('myFrame');
}

Thanks
Phil