that code is not attached to a button or a movieclip.
and it's bad practice to attach code to buttons/movieclips. click your object in frame 1 (to select it) and, in the properties panel assign an instance name. eg, btn1.
attached to frame 1 (not the object), use:
p.s. clear your latter keyframe in the layer that contains btn1 and then insert a new keyframe.
I did what you suggested and there are no more compile errors; however the buttons do not do anything. They don't work. Initially, I did go into properties and assign a name.
Ok, I deleted all my buttons and went through the way you suggested and it all works now.