質問

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;
        }
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top