Handling State Events
Four events are associated with state changes:
When a state change is requested, the application or component containing the state dispatches a
currentStateChangingevent. The event occurs before the state actually changes.Once the state has changed, the application or component dispatches a
currentStateChangedevent. Both events are of typemx.events.StateChangeEvent(use the constantsCURRENT_STATE_CHANGINGandCURRENT_STATE_CHANGEDto add listeners). Neither event is cancelable, which means you cannot prevent a state change from occurring by canceling acurrentStateChangingevent, for example. Rather, both events are used primarily by the transitions framework to detect when a transition should occur.The
enterStateandexitStateevents occur when the state starts and stops:The
enterStateevent occurs as soon as the state has started but before it is applied to the view.The
exitStateevent occurs as soon as the state is about to stop.Both events are of type
mx.events.FlexEvent(use the constantsENTER_STATEandEXIT_STATEto add listeners).
The
enterStateevent is dispatched by aStateobject when the state starts, and by an application or component when returning to the base state. TheexitStateevent is dispatched by aStateobject when the state stops, and by an application or component when exiting the base state.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access