In what way is it not working?
I just cut and paste the whole thing into Flex Builder 4, ran it and it behaved fine.
it is not tracing anything here ?!
Here try this:
It should show a Alert on enter and exit viewState.
I tried adding the event Listener in two different ways, both do not work !
What am I missing ?
Try currentStateChange event instead of enterState event.
currentStateChange is Dispatched after the view state has completed changing. It is dispatched by a component after its currentState property changes.
and your function should look like as below. Notice that the event type is changed here from FlexEvent to StateChangeEvent.
protected function application1_enterStateHandler(event:StateChangeEvent):void
Alert.show('state changed'+ this.currentState);