Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
protected function transitionTo( nextState:State, data:Object=null ):void { // Going nowhere? if ( nextState == null ) return; // Clear the cancel flag canceled = false; // send exiting notification for the current State if ( currentState && currentState.exiting ) sendNotification( currentState.exiting, data, nextState.name ); // Check to see whether the exiting guard has been canceled if ( canceled ) { canceled = false; return; } // send entering notification for the next State if ( nextState.entering ) sendNotification( nextState.entering, data ); // Check to see whether the entering guard has been canceled if ( canceled ) { canceled = false; return; } // only change state nownow currentState = nextState; // Send the notification configured to be sent when this specific state becomes current if ( nextState.changed ) sendNotification( currentState.changed, data ); // Notify the app generally that the state changed and what the new state is sendNotification( CHANGED, currentState, currentState.name ); }
// Check to see whether the entering guard has been canceled if ( canceled ) { canceled = false; return; }