开发者

getChildren() not working for ViewStack in Flex

开发者 https://www.devze.com 2023-02-17 08:08 出处:网络
My Strucutre is like this. <mx:ViewStack> <mx:HBox> <mx:Form> <mx:FormItem> . 开发者_如何学Go.

My Strucutre is like this.

<mx:ViewStack>
    <mx:HBox>
        <mx:Form>
            <mx:FormItem>
    .
 开发者_如何学Go   .
    .
    <mx:HBox>
        <mx:Form>
            <mx:FormItem>   
</mx:ViewStack> 

When I call the getChildren method on ViewStack, I only get the first HBox and not the others. How to get others as well?


An alternative is to set the creationPolicy of the viewStack to all, otherwise as far as Flex is concerned it only has one child. Setting it to 'all' creates all the children up front.

You could also keep a int variable with the number of children, and if any are added, increment that variable. Then use viewStack.selectedItem = ? in your code.


Since ViewStack hides tabs other than selected one, they aren't returned with getChildren(). Try numChildren and getChildAt(), it should help.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号