Check out the code below. You can pre-set the width of the MenuBar item you want to act as a spacer (just be sure to disable it otherwise it will respond to mouse activity). Individual MenuBar items are accessible off the main MenuBar control via the 'menuBarItems' property. Unfortunately, separators don't work in top-level MenuBar item renderers. That would be a good ECR to file.
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:MenuBar id="mb" showRoot="false" labelField="@label" width="100%" creationComplete="setSpacer();"> <mx:dataProvider> <mx:XML xmlns=""> <node label="root"> <node label="Item 1"> <node label="child 1" /> </node> <node label="Item 2"> <node label="child 1" /> </node> <node label="" enabled="false" /> <node label="Item 3"> <node label="child 3" /> </node> </node> </mx:XML> </mx:dataProvider> </mx:MenuBar> <mx:Script> <![CDATA[ private function setSpacer():void { //Array of menubar items var menus:Array = mb.menuBarItems; var iter:Number = 0; var spacerIndex:Number = -1; for (var i:int = 0; i < menus.length; i++) { //sum up the widths of all the "non-spacer" menu bar items if (menus[i].data != "") iter += menus[i].width; //figure out the index of the spacer menu bar item else spacerIndex = menus[i].menuBarItemIndex; } //set the width menus[spacerIndex].width = mb.width - iter; } ]]> </mx:Script> </mx:Application> ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sergey Kovalyov Sent: Tuesday, December 11, 2007 2:16 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Spacer in MenuBar Hi All! Is it possible to add 100% spacer to MenuBar as shown in the file attached and if so, how would you do that? Thank you in advance. Sergey.