In Flex 3.0, I made a state which has draggable windows (CollapsableTitleWindow code written by someone else, but that’s irrelevant).
Then, I created a new viewstate, which repositions the windows around a bit.
<mx:State name="newstate" basedOn="firststate">
<mx:SetProperty target="{window1}" name="width" value="50%"/>
<mx:SetProperty target="{window2}" name="x" value="{window1.width + 5}"/>
I want to position one window next to the other on load, but I don’t want the second window to move when the user drags the first one around.
How can I bind the x to the value of (window1.width + 5) at load, but then lose the continuous evaluation of the thing?
You could set the x property in an event listener for one of the state changing events: enterState, exitState, currentStateChange or currentStateChanging.
Here’s Adobe’s documentation.
You could try an event handler for the enterState event :
UPDATE:
From Tominator’s comments below:
The result is that I get the output:
You may want to try calling
window1.validateDisplayList()orvalidateNow()after setting thepercentWidthproperty.