In CS5 (though I assume it works for other versions) you need to go into File>Publish Settings...
...and then make sure you "Gif Image" is selected.
Alternatively, you can go File>Export>Export Movie and then choose to export as an Animated GIF (but NOT a GIF Sequence, trust me on this one).
A couple caveats: First of all, unless you want your GIF to slow to a crawl then you need to give your flash file a pretty low frame rate, probably around 10 FPS. Second of all you may need to tweak some of the GIF publishing settings (also in File>Publish Settings) to get it looking right.