I have five states in flex and change between them randomly.
How to get information about previous state (the active state before currentState
) in flex?
Add a listener to the state changing event of your object and save the current state to a variable.
This could look like the following:
<fx:Script>
<![CDATA[
private var previousState : String;
protected function onCreationComplete($event : FlexEvent) : void
{
yourObject.addEventListener(StateChangeEvent.CURRENT_STATE_CHANGING,
onChangingState);
}
protected function onChangingState($event : StateChangeEvent) : void
{
previousState = $event.oldState;
}