After reading your second post with the .addChild I guess this would be 
helpful. Here it is

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
creationComplete="addTI()" >

        <mx:Script>
                <![CDATA[
                        import mx.controls.TabBar;
                        import mx.containers.VBox;
                        import mx.controls.TextInput;
                        private var ti:TextInput = new TextInput
                        
                        private function addTI():void
                        {
                                tabN.rawChildren.addChild(ti);
                        }       
                        private function Upda():void
                        {
                                var tabBar:TabBar = tabN.getTabAt(0).parent as 
TabBar;
                                var leftOffset:Number = 
tabN.getStyle("tabOffset");                     
                                var borderThick:Number = 
tabN.getStyle("borderThickness");
                                
                                ti.width = 100
                                ti.height = tabN.getTabAt(0).height
                                
                                switch (tabN.getStyle("horizontalAlign"))
                        {          
                                case "left":
                                        tabBar.move(0 + borderThick + 
leftOffset, tabBar.y);
                                    ti.move(0 + borderThick + leftOffset + 
tabBar.width, tabBar.y)
                                    break;
                                case "right":
                                        tabBar.move(tabN.width - tabBar.width - 
ti.width -borderThick + leftOffset, tabBar.y);
                                    ti.move(tabN.width - ti.width -borderThick 
+ leftOffset, tabBar.y)
                                    break;
                                case "center":
                                        tabBar.move((tabN.width - tabBar.width 
- ti.width) / 2 + leftOffset, tabBar.y);
                                    ti.move((tabN.width+ tabBar.width - 
ti.width ) / 2 + leftOffset, tabBar.y)
                        }
                        }
                ]]>
        </mx:Script>
        
           
                <mx:TabNavigator id="tabN" width="100%" height="100%"  
updateComplete="Upda()">
                        <mx:VBox >
                                
                        </mx:VBox>
                        <mx:VBox >
                                
                        </mx:VBox>
                        <mx:VBox >
                                
                        </mx:VBox>
                </mx:TabNavigator>
                        
    <mx:HBox>
        <mx:Button click="tabN.addChild(new VBox)" label="add child"/>
        <mx:Button click="tabN.removeChildAt(0)" label="remove child"/>
        <mx:Button click="tabN.setStyle('horizontalAlign','left')" label="left 
align"/>
        <mx:Button click="tabN.setStyle('horizontalAlign','center')" 
label="center align"/>
        <mx:Button click="tabN.setStyle('horizontalAlign','right')" 
label="right align"/>
        </mx:HBox>
</mx:Application>


quote:

        Although at the level of a Flash DisplayObjectContainer, all children 
are equal, in a Flex Container some children are "more equal than others". 
(George Orwell, "Animal Farm")
        In particular, Flex distinguishes between content children and
non-content (or "chrome") children. Content children are the kind that can be 
specified in MXML. If you put several controls into a VBox, those are its 
content children. Non-content children
are the other ones that you get automatically, such as a
background/border, scrollbars, the titlebar of a Panel, AccordionHeaders, etc.

        Most application developers are uninterested in non-content children, 
so Container overrides APIs such as numChildren and getChildAt() to deal only 
with content children. For example, Container, keeps its own _numChildren 
counter.
        Container assumes that content children are contiguous, and that 
non-content children come before or after the content children.
        In order words, Container partitions DisplayObjectContainer's
index range into three parts:

        A B C D E F G H I
        0 1 2 3 4 5 6 7 8    <- index for all children
              0 1 2 3        <- index for content children

        The content partition contains the content children D E F G.
        The pre-content partition contains the non-content children A B C that 
always stay before the content children.
        The post-content partition contains the non-content children H I that 
always stay after the content children.

        Container maintains two state variables, _firstChildIndex and 
_numChildren, which keep track of the partitioning. In this example, 
_firstChildIndex would be 3 and _numChildren would be 4.

quote:

       A container typically contains child components, which can be enumerated 
using the Container.getChildAt() method and Container.numChildren property. In 
addition, the container may contain style elements and skins, such as the 
border and background.
       Flash Player and AIR do not draw any distinction between child 
components and skins.  They are all accessible using the player's getChildAt() 
method  and numChildren property.  
       However, the Container class overrides the getChildAt() method and 
numChildren property (and several other methods) to create the illusion that 
the container's children are the only child components.
     
       If you need to access all of the children of the container (both the 
content children and the skins), then use the methods and properties on the 
rawChildren property instead of the regular Container methods. For example, use 
the Container.rawChildren.getChildAt()) method. However, if a container creates 
a ContentPane Sprite object for its children, the rawChildren property value 
only counts the ContentPane, not the container's children. It is not always 
possible to determine when a container will have a ContentPane.
      
       Note: If you call the addChild or addChildAt method of the rawChildren 
object, set tabEnabled = false on the component that you have added.
       Doing so prevents users from tabbing to the visual-only component that 
you have added.

    

Reply via email to