There's no easy way to do this. Once a shape is drawn to the stage, the only graphical information you can access is the rendered pixel bitmap; all vector information is lost.
To transform shapes into polygons, you'll have to either analyze the ActionScript byte code stored in the SWF file (find and extract the bytes that contain vector drawing information and use it to re-create the shapes in code), or use the color info in the bitmaps to trace shapes (which is never going to be fully accurate, as you might guess).
Either way, this is not a simple task.