when i do stuff like that, i add what i call "roots" to my movie...
so for your situation.. i would put this piece of code on a separate layer called roots

_root.rotating = 0;

and when your movie starts, rotating will = 0.

then where your actions for your button are.. tell it that if _root.rotating = 0 then the button is clickable... else.. its not...

so then where your button tells the gears to rotate.. tell it to tell _root.rotate to = 1. and when it stops rotating.. tell it to go back to = 0 so you can click your button again...

i use this same concept to implement a pause menu in games... pretty handy. and simple.