Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Adobe Flex SDK Previous
-
None
-
Affected OS(s): All OS Platforms
Language Found: English
Description
Steps to reproduce:
1. Run the code below
2. Click on the left button to toggle into state s2
3. Click on the left button again to go back to state s1
4. Click on the left button again to go back to state s2
5. Click one more time to go back to state s1
Actual Results:
The buttons both stay in their s2 sizes - no more animations ever happen
Expected Results:
The buttons should always toggle between their sizes in s2 (both half the width of the window) and in s1 (left button should be small).
Workaround (if any):
There are a couple workarounds in this particular situation, but some situations may not have a workaround:
1) Run Resize only on button b1; the other button always has percentWidth of 100%, so it should always do the right thing in its layout when the width of b1 changes.
2) Set state-specific information for b1's width in state s1. So instead of saying width="100%", say width.s1="100%". This forces the state mechanism to animate to/from that value every time instead of trying to infer from (wrong, in this case) information in the current values of the button's properties.
3) Run separate Resize effects for every target. The root cause of this problem is that a multi-target Resize is performing some end-effect operations too soon. A fix would be, like (1) above, to run the effects on just one target instead.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:states>
<s:State name="s1"/>
<s:State name="s2"/>
</s:states>
<s:transitions>
<s:Transition>
<s:Resize targets="
"/>
</s:Transition>
</s:transitions>
<s:VGroup width="100%">
<s:HGroup width="100%">
<s:Button id="b1" width="100%" width.s2="10%"
click="currentState = (currentState == 's1') ? 's2' : 's1'"/>
<s:Button id="b2" width="100%"/>
</s:HGroup>
</s:VGroup>
</s:Application>