      */
     private var autoSetRoundedCorners:Boolean;
 
+    /** 
+     *  @private
+     */
+    private var inCreateComponentsFromDescriptors:Boolean;
+
     //--------------------------------------------------------------------------
     //
     //  Overridden properties

    override public function createComponentsFromDescriptors(
                                recurse:Boolean = true):void
    {
        super.createComponentsFromDescriptors();
        
        if (numChildren == 0)
        {
            setControlBar(null);
            return;
        }
        

        {
            setControlBar(null);
        }
        
        inCreateComponentsFromDescriptors = false;        
    }

    /**
     *  @private
     * 
     *  Container implements addChild in terms of addChildAt. 
     */
    override public function addChildAt(child:DisplayObject,
                                        index:int):DisplayObject
    {
        // Special case for adding the control bar.
        super.addChildAt(child, index);
        if (!inCreateComponentsFromDescriptors &&
            child is ControlBar)
            createComponentsFromDescriptors();
        
        return child;
    }
    
    /**
     *  @private
     * 
     *  Container implements removeChildAt in terms of removeChild.
     */
    override public function removeChild(child:DisplayObject):DisplayObject
    {
        // If the control bar is the last child.
        if (!inCreateComponentsFromDescriptors &&
            child is ControlBar && numChildren > 0 &&
            child == getChildAt(numChildren - 1))
        {
            rawChildren.removeChild(child);
            createComponentsFromDescriptors();
            return child;
        }
        
        return super.removeChild(child);
    }
    
    //--------------------------------------------------------------------------
    //
    //  Methods
