资 源 简 介
Introduction
Often in an application it is necessary to be able to define and then switch the application state based on either user input or data updates. The Finite State Machine (FSM) is our version of a State Machine in Actionscript 3. The FSM uses StateControllers to manage lists of State Objects. A State Object is anything that implements IState. The FSM includes 2 such objects: State, which is the most basic example and StateView which is useful for classes that are also DisplayObjects.
Getting Started
The FSM includes 2 controllers. The most basic is StateController. A StateController is a management interface for a list of state sub objects. When a StateController is told to exit or enter, the controller then in return tells all of its sub objects to exit or enter. It then waits until all of the sub objects have finished their exits/enters and dispatches and event notifying of its completion. All commands directed at a State should go through