I've been just messing around with how to do things through code. It seems adding a ControlBar to a panel in code doesn't do the same thing as it does in mxml.

here is my mostly code example:

MXML:

<?xml version=" 1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp()">
    <mx:Script>
        import ControlBarInPanel;
       
        private function initApp():void
        {
            var cbip:ControlBarInPanel = new ControlBarInPanel();
            addChild( cbip );
        }
    </mx:Script>
</mx:Application>

AS3:

package
{
    import mx.containers.Canvas;
    import mx.containers.Panel;
    import mx.containers.ControlBar;
    import mx.controls.Button;
    import mx.events.FlexEvent;
   
    public class ControlBarInPanel extends Canvas
    {
        public function ControlBarInPanel()
        {
            super();
            addEventListener( FlexEvent.CREATION_COMPLETE, handleCreationComplete );
        }
       
        private function handleCreationComplete( event:FlexEvent ):void
        {
            percentWidth = 100;
            percentHeight = 100;
            var tb:Button = new Button();
            tb.label = "Test Button in Panel";
           
            var p:Panel = new Panel();
            p.title = "Test Control Bar in Panel";

            var cb:ControlBar = new ControlBar();
           
            var tb2:Button = new Button();
            tb2.label = "Test Button in Control Bar";
           
            addChild( p );
            p.addChild( tb );
            p.addChild( cb );
            cb.addChild( tb2 );
        }
    }
}


this all works fine, but when the control bar gets added to the panel it is inside of the White content Area in the panel.

Now when I do the same thing but with MXML::

<?xml version="1.0" encoding="utf-8" ?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml " layout="vertical">
<mx:Canvas percentWidth="100" percentHeight="100" >
    <mx:Panel title="Test Control Bar in Panel">
        <mx:Button label="Test Button in Panel" />
        <mx:ControlBar horizontalAlign="right">
            <mx:Button label="Test Button in ControlBar" />
        </mx:ControlBar>
    </mx:Panel>
</mx:Canvas>
</mx:Application>



it puts the control bar under the white content area in a panel.




what is going on behind the scenes in mxml that is causing the difference??




__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to