Hello aaron,

i had the same problem recently...

you just have to change the order of you components when you add 
them to the panel, as far as i know the controlBar has to be the 
last one to be add in order to be under the white content area of 
the panel, try the following...

            p.addChild( tb );
            cb.addChild( tb2 );
            p.addChild( cb );
            addChild( p );  

and ill work fine.

--- In [email protected], "aaron smith" 
<[EMAIL PROTECTED]> wrote:
>
> 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 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to