enterState Flex Event

The enterState event is dispatched from the State class when a new state has been entered. The class that actually dispatches this event is UIComponent. State is actually a very small class that exposes an mx_internal method dispatchEnterState() which UIComponent hijacks since it is in charge of applying states to itself:

  1.     private function applyState(stateName:String, lastState:String):void
  2.     {
  3.         var state:State = getState(stateName);
  4.  
  5.         if (stateName == lastState)
  6.             return;
  7.            
  8.         if (state)
  9.         {
  10.             // Apply "basedOn" overrides first
  11.             if (state.basedOn != lastState)
  12.                 applyState(state.basedOn, lastState);
  13.  
  14.             // Apply new state overrides
  15.             var overrides:Array = state.overrides;
  16.  
  17.             for (var i:int = 0; i < overrides.length; i++)
  18.                 overrides[i].apply(this);
  19.  
  20.             // Dispatch the "enterState" event
  21.             state.dispatchEnterState();
  22.         }
  23.     }

This code is called from commitCurrentState() which is also a private method in UIComponent.

Search Great Flex/Flash Sites