Reputation: 196
the first time I change from state A to B it doesn't play the transition. After the first transition, the same state change does play the transition.
Before I let state B load, it parses an xml file and maps it to objects. When this is done, the state changes. Maybe it has to do with the parsing of the xml. But I can confirm that parsing is done, before it changes the state.
<s:Transition toState="B">
<s:Sequence>
<s:Move target="{menu}" duration="300" />
<s:AddAction target="{newsPostsList}" />
<s:Fade target="{newsPostsList}" />
</s:Sequence>
</s:Transition>
Upvotes: 0
Views: 1027
Reputation: 1927
I found I had to put the code: includeIn="<my state>" itemCreationPolicy="immediate"
on ALL of the components that were in the state to be transitioned to. Once the items are created the transition worked smoothly.
It seems that VGroups do not pass the itemCreationPolicy
setting down to their children thus making it necessary to repeat this code on all of the elements.
Upvotes: 0
Reputation: 11
You need to look at the creationPolicy of the components contained in the state. By default it is uninstantiated. creationPolicy ="all" can be added to the addChild element or in my case, to the viewstack - I lost hours in trying to solve this problem. All now works smoothly.
Upvotes: 1
Reputation: 196
I found the source of evil :) Turns out I fired the state change a little before the parsed data was available to the model.
Thanks to everyone for helping me out on this. I've had problems with transitions not firing the first time already before. Your answers will be a resource to check for common mistakes.
Upvotes: 0
Reputation: 1
It turned out that I had to get rid of "includeIn=myState" and replace those with "visible.myState=true" and "includeInLayout.myState=true". It made the transitions run every time.
Upvotes: 0
Reputation: 546
Try to disable the XML parsing to be sure that isn't the problem. You could also explicitly specify the from state of your transition (either state "A" or state "*" for any state). Also try to add explicit x and y values for your Move action, just for sanity. It could be that the x and y positions of your menu component between states A and B aren't different.
Upvotes: 0