Calling createComponentsFromDescriptors () would invoke Panel'smethod which adds the ControlBar as the lastChild irrespective of the order in which it is added. Making an explicit call to the method will do the layouting for us.

HTH

Harish

On 9/18/06, aaron smith <[EMAIL PROTECTED]> wrote:

beautiful, it must update the display?



On 9/18/06, Harish Sivaramakrishnan < [EMAIL PROTECTED] > wrote:

You can add the children in any order as long as you call this function at the end of adding all children

    createComponentsFromDescriptors ();

Thanks
Harish

PS: This works when you extend from Panel.



On 9/15/06, aaron smith < [EMAIL PROTECTED]> wrote:

hey thanks man. works as expected now. That does make sense that the order of adding children matters..

thanks

AaronSmith



On 9/14/06, gustavo.saume <[EMAIL PROTECTED]> wrote:

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 flexcoders@yahoogroups.com, "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





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