Frage

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?

War es hilfreich?

Lösung

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;
        }
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top