If control-bar is not last child of Panel in MXML, it is rendererd as normal children. Which means, ControlBar as control-bar in Panel is special case and handled differently.

If you want to add control-bar to Panel using ActionScript, you need to follow these steps:-

1) Add controlBar instance as last child in Panel
2) call createComponentsFromDescriptors () method of Panel.

ex:

    var controlBar:ControlBar  = new ControlBar ();
    var button:Button = new Button ();
    button.label ="Hey";
    controlBar.addChild (button);
     panel.addChild (controlBar);
     panel.createComponentsFromDescriptors ();   


That works but I learnt above by looking into Panel source code and by recalling things from ApplicationControlBar development process..

So please keep looking at other things also, may be there is better way.

-abdul

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

Hello all,

is there a way to create a controlBar in a script and assign it to a
Panel??

i´ve tryed the following with not success:

<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" initialize="init
();" layout="vertical" width="100%" height="100%">
<mx:Script>
<![CDATA[
import mx.controls.Button;
import mx.containers.HBox;
import mx.containers.ControlBar;

private function init():void
{
var btnSave:Button = new Button();

var cntrl:ControlBar = new ControlBar();
cntrl.addChild(btnSave);

this.controlBar = cntrl;
}
]]>
</mx:Script>
</mx:Panel>


__._,_.___

--
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