Exported the gif from Flash with unexpected colors

Problem:
Exported the gif from Flash with unexpected colors

Solution:
1. Open the image in Photoshop
2. Select Image -> Mode -> Indexed Color
3. Select Image -> Mode -> Color Table -> Save
4. Return to Flash
5. Select File -> Publish Setting
6. Palette Type: Custom
7. On the Palette field, choose the file you saved from Photoshop
8. Publish