Button problem

everytime i try to make a button that make u go to another frame it says this

Error Scene=Scene 1, layer=Layer 1, frame=1:Line 1: Statement must appear within on handler
gotoAndPlay(3);

Total ActionScript Errors: 1 Reported Errors: 1

can anyone help?