WOW... this is excellent. tnx Harish - just what i was looking for! one question though - is there a way to get an array of the states (selected/unselected)of all buttons?
--- In flexcoders@yahoogroups.com, "Harish Sivaramakrishnan" <[EMAIL PROTECTED]> wrote: > > use the following class that i wrote which extends ToggleButtonBar. You need > to set an additional property called _allowMultipleSelection= true to enable > multi selection. > > //Main.mxml > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" > xmlns:my="*"> > <mx:Script> > <![CDATA[ > > ]]> > </mx:Script> > <my:MultiToggleButtonBar dataProvider="['one','two','three']"> > > </my:MultiToggleButtonBar> > </mx:Application> > > //MultiToggleButtonBar.as > > package > { > import mx.controls.ToggleButtonBar > import mx.controls.Button > import flash.events.Event; > import flash.events.KeyboardEvent; > import flash.events.MouseEvent; > import flash.ui.Keyboard; > import mx.core.IFlexDisplayObject; > import mx.core.mx_internal; > import mx.events.FlexEvent; > > use namespace mx_internal; > public class MultiToggleButtonBar extends ToggleButtonBar > { > public var _allowMultipleSelection:Boolean = true > public var indicesArray:Array; > public function MultiToggleButtonBar():void > { > super() > } > override protected function hiliteSelectedNavItem(index:int):void > { > var child:Button; > var selectedchild:Button; > if(_allowMultipleSelection) > { > > > child = Button(getChildAt(index)); > > > var selectedButtonTextStyleName:String = > getStyle(selectedButtonTextStyleNameProp); > > child.getTextField().styleName = > selectedButtonTextStyleName ? > selectedButtonTextStyleName : > "activeButtonStyle"; > > child.invalidateDisplayList(); > } > else > { > // Un-hilite the current selection > if (selectedIndex != -1 && selectedIndex < numChildren) > { > child = Button(getChildAt(selectedIndex)); > > child.selected = false; > child.getTextField().styleName = child; > > child.invalidateDisplayList() > } > > // Set new index > super.selectedIndex = index; > > if (index != -1) > { > // Hilite the new selection > child = Button(getChildAt(selectedIndex)); > > child.selected = true; > > var selectedButtonTextStyleName:String = > getStyle(selectedButtonTextStyleNameProp); > > child.getTextField().styleName = > selectedButtonTextStyleName ? > selectedButtonTextStyleName : > "activeButtonStyle"; > > child.invalidateDisplayList(); > } > } > } > > } > } > > On 11/15/06, shemeshkale <[EMAIL PROTECTED]> wrote: > > > > hi, > > is it possible to make a ToggleButtonBar that more then one button can > > be selected? > > > > basically i m trying to do a bar of buttons that each one of them can > > be selected/deselected disregarding the state of the others. > > i could put them buttons inside an HBox with horizontalGap="0", but i > > really want to acheive the look of a ButtonBar where the outer buttons > > have their outer corners rounded and all other corners are > > cornerRadius="0". so, in this approach - how can i make a button that > > each of his corner radius is different? > > > > any ideas? > > > > > > >