I have done this a lot of times! Select all the frames in the main timeline containing the animation, right click and select “Copy Frames”. Create a new movie symbol. In the new movie symbol, select one of the frames, right click and select “Paste Frames.” Voila!
Now, create a button symbol. On the rollover frame, drag an instance of the previous movie clip. You can now delete all the stuff in the main timeline (unless you want to keep that animation there for something else. Drag an instance of the said button onto the main timeline.
Now publish the file and it should create two things: the swf file and an HTML file that has the animation in it. If you want to add the animation to a page you have made previously, open up the HTML file and find the embed/object codes. Copy and paste them into your pre-made HTML file.