Events are the heart of Actionscript. Without them, you are pretty much completly rendered helpless when creating, pretty much anything, in Flash. Events are basically different actions that if performed, follow through with a block of code.
Select what you want to copy and in doing so you will keep the formatting when pasting it.
The first code block inserts the event into a function and follows through with the code when it has happened. Remember, all events (not placed on buttons or mc's) must be placed on in a function syntax, or else it won't work.
The next code block is the same as the first, but with different syntax.
The third places the event directly on a movieclip, so it has direct access the that movieclip (the syntax also applies to that when on a movieclip, so you still need to call _root when reffering to other objects).
The final one places a the event on a seperatly declared function, so you can switch the functions around when you want to.
Finally, here's a list of every the most used events and what they do:
onMouseDown- When the mouse button is clicked
onMouseUp- When the mouse button is released
onMouseMove- When the user moves the mouse
onMouseWheel- When the mouse wheel is used
onLoad- When the frame/movieclip/button first loads
onEnterFrame- Runs the function the number of your fps per second
onPress- When a button or movieclip is pressed
onRelease- When a button or movieclip is released
onReleaseOutside- When a button or movieclip is released outside of its bounding box
onRollOver- When a button or movieclip has the mouse moved over it
onRollOut- When a button or movieclip has the mouse moved off of it
onKeyDown- When the user presses any key on their keyboard
onKeyUp- When the user releases any key on their keyboard