An AS3 Finite State Machine