You probably want to go through the tutorials that come with
Flash. They will give you the basics.
From your code it looks like you are using, or trying to use,
Actionscript 2. If you are using AS2, then the function that you
show would be attached directly to a button instance on the stage.
However, you'll have to change it. The correct version would look
The first line is the event that the object will receive, in
this case, when the user lets go of the mouse button. Then, there
are a pair of curly braces. Everything inside these braces are the
instructions for actionscript to follow.
An alternative, and much better, method in AS2 is to give
each object on the stage an instance name. Then you can refer to
that object by its instance name. You can find out more about this
in the online help.
If you are using AS3, then the code that you quoted above
will never work.