animating Flag, Help!

im trying to animate a flag then put it in the game engine, meaning i need to somehow get the simulation in the action editor, which I have no idea how to do that, does anyone know, want to explain?