Question

From a viewClass called TheFirstView I want to "move" to a viewClass called TheSecondView with the state SpecificState.

I know how to get to the TheSecondView, the code is: navigator.pushView(TheSecondView);

Is there a way to specify using pushView() that you want to "move" to SpecificState in TheSecondView?

Était-ce utile?

La solution

You can pass data into the view; which is the second property of the pushView method, like this:

navigator.pushView(TheSecondView, 'SpecificState')

Inside the view, you can listen for the viewActivated event to change the state:

Add the listener:

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" viewActivate="onViewActivated()">

And in some ActionScript code, implement the listener like this:

protected function onViewActivated():void{
 currentState=data;
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top