I am having a little difficulty working with states in Flex (or Flash) 4. Lets say that my application has three states; the default (base) state, state 1, and state 2.
State 1 should always be based on the base state, that’s easy enough to accomplish. However, I would like state 2 to be based on the current state (either base or state 1). I can’t for the life of me figure it out. I tried setting the basedOn property of state 1 to “this.currentState”, but that just crashes my browser.
<s:states>
<s:State name="default"/>
<s:State name="state1"/>
<s:State name="state2" basedOn="{this.currentState}"/>
</s:states>
<s:TitleWindow id="configWindow" includeIn="state1" width="250" height="100%" close="configWindow_closeHandler(event)"/>
<s:Panel id="settings" includeIn="state2" width="200" height="200"/>
basedOn is not a Bindable property, which is why the value isn’t changing in your code.
In theory, it is a read/write property so you can change it at runtime; but you’ll have to do so manually, probably in ActionScript.
Based on your code snippet; I don’t understand why you want to do this. As soon as you change the state to ‘state2’ wouldn’t you enter into a weird loop?