Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
<state name={STATE_REGISTERING} changed={REGISTER_TRY}> <transition action={ACTION_REGISTER_OK} target={STATE_REGISTERED}/></state>
// 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 );
// Notify the app generally that the state changed and what the new state is sendNotification( CHANGED, currentState, currentState.name );// Send the notification configured to be sent when this specific state becomes current if ( nextState.changed ) sendNotification( currentState.changed, data );
So I make a listener for REGISTER_TRY and in that function I want to check the state if it's STATE_REGISTERED. But it's not
{ // Going nowhere? if ( nextState == null ) return; // Clear the cancel flag canceled = false; // Exit the current State if ( currentState && currentState.exiting ) sendNotification( currentState.exiting, data, nextState.name ); // Check to see whether the transition has been canceled if ( canceled ) { canceled = false; return; } // makes currentState into a neutral State currentState = new StateTransitionState(); // Enter the next State if ( nextState.entering ) sendNotification( nextState.entering, data ); 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 ); }
protected function transitionTo( nextState:State, data:Object=null ):void { // Going nowhere? if ( nextState == null ) return; // Clear the cancel flag canceled = false; // Exit the current State if ( currentState && currentState.exiting ) sendNotification( currentState.exiting, data, nextState.name ); // Check to see whether the transition has been cancelled in the exiting state if ( canceled ) { canceled = false; return; } // Enter the next State if ( nextState.entering ) sendNotification( nextState.entering, data ); // Check to see whether the transition has been cancelled in the entering state if ( canceled ) { canceled = false; if ( currentState.entering ) sendNotification( currentState.entering, data ); }else{ currentState = nextState; } // Send the notification configured to be sent when this specific state becomes current if ( currentState.changed ) sendNotification( currentState.changed, data ); // Notify the app generally that the state changed and what the new state is sendNotification( CHANGED, currentState, currentState.name ); }