An Action Script 3 implementation of hierarchical finite-state machine (HFSM).