I'm fooling around with States after being a .animate kind of guy for a long time.
I have a small question: I'm using the "onStateDidSwitch" event, but I only want to use it if the layer goes from Default to stateA.
Is there at way to say onStateDidSwitch from Default to stateA then switch do stateB, if onStateDidSwitch from stateB to stateC then switch to stateD, etc?
I think layer.states.current will help you here :)
I'm trying this setup. The start works fine, the problem is when I click Compose the second time and it changes to "stateClose" then the "onStateDidSwitch" fires again and change it back to "stateB"
Use states did switch still but put your conditional inside the DidSwitch event function.
Similar to what you are doing above.