Help making button work according to frame

Hi Guys I’m making a button operate with this code:
stop();
this.onEnterFrame = function() {
if (rewind == true) {
prevFrame();
}
};
this.onRollOver = function() {
rewind = false;
play();
};
this.onRollOut = function() {
rewind = true;
};
this.onRelease = function() {
with (_root) {
play();
}
};
What I need to do is make this only work, if the root is on a certain frame, say frame 1, and stop the button from working on other frames, but still be visable.
can anyone help?