[ 
https://issues.apache.org/jira/browse/FLEX-28132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13695522#comment-13695522
 ] 

Patrick Buchheit commented on FLEX-28132:
-----------------------------------------

I've done some more digging, and the root issue seems to be having a mix of 
stateful and non-stateful children in the container. If you look at the 
generated code, the default behaviour for an AddItems override is to track a 
component in a view state relative to the first component it can find that is 
NOT in a view state. If that 'relative' component hasn't been added to the 
parent yet, the attempt to get the item index will fail and result in an 
incorrect positioning of the component. In the original poster's case, the 
cause is slightly different. There it's the 'destination' property ( the 
BorderContainer) that hasn't been initialized yet, but the end result is the 
same. Since the component index can't be obtained, the new component simply 
gets added at index 0. 
                
> Wrong element order when using SkinnableContainer and states
> ------------------------------------------------------------
>
>                 Key: FLEX-28132
>                 URL: https://issues.apache.org/jira/browse/FLEX-28132
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Spark: SkinnableContainer
>    Affects Versions: Adobe Flex SDK 4.5.1 (Release)
>         Environment: Affected OS(s): Windows
> Affected OS(s): Windows 7
> Language Found: English
>            Reporter: Adobe JIRA
>         Attachments: BugExample.mxml
>
>
> When I use a descendant of the SkinnableContainer (eg BorderContainer) which 
> itself is included or excluded in a state, the child elements in the default 
> state appears in incorrect order (Label "B" before Label "A").
> This problem disappears when using a Group instead of BorderContainer, or 
> when the container itself is not included or excluded in a state, or when 
> states changes forth and back.
> <?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">
>     <s:states>
>         <s:State name="state1" />
>         <s:State name="state2" />
>     </s:states>
>     <s:VGroup>
>         <s:BorderContainer includeIn="state1,state2">
>             <s:layout>
>                 <s:HorizontalLayout paddingLeft="10" paddingTop="10" />
>             </s:layout>
>             <s:Label text="A"/>
>             <s:Label text="B" includeIn="state1" />
>         </s:BorderContainer>
>         <s:Button label="state" click="currentState = currentState == 
> 'state1' ? 'state2' : 'state1';" />
>     </s:VGroup>
> </s:Application>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to