This simple test worked for me. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Style> <![CDATA[ .foo { text-decoration : underline; } ]]> </mx:Style> <mx:Script> <![CDATA[ import mx.core.UIComponent; private function styleit():void { UIComponent(tbb.getChildAt(0)).setStyle("fontStyle", "italic"); UIComponent(tbb.getChildAt(1)).setStyle("styleName", "foo"); } ]]> </mx:Script> <mx:ToggleButtonBar id="tbb" dataProvider="{vs}" /> <mx:ViewStack id="vs" width="200"> <mx:VBox label="foo"> <mx:Label text="foo" /> <mx:Button label="bar" /> </mx:VBox> <mx:HBox label="bar"> <mx:Label text="foo" /> <mx:Button label="bar" /> </mx:HBox> </mx:ViewStack> <mx:Button click="styleit()" /> </mx:Application>
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Guillermo Villasana Sent: Wednesday, October 03, 2007 4:45 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Change style on each button on a ToggleButtonBar Sorry. Here is what I am doing: <!-- css code --> .button1 { disabledSkin: Embed(source="skin_registro.swf", symbol="boton1_disable"); downSkin: Embed(source="skin_registro.swf", symbol="boton1_hit"); overSkin: Embed(source="skin_registro.swf", symbol="boton1_over"); selectedDisabledSkin: Embed(source="skin_registro.swf", symbol="boton1_disable"); selectedDownSkin: Embed(source="skin_registro.swf", symbol="boton1_hit"); selectedOverSkin: Embed(source="skin_registro.swf", symbol="boton1_over"); selectedUpSkin: Embed(source="skin_registro.swf", symbol="boton1_up"); upSkin: Embed(source="skin_registro.swf", symbol="boton1_up"); } .button2 { disabledSkin: Embed(source="skin_registro.swf", symbol="buton2_disable"); downSkin: Embed(source="skin_registro.swf", symbol="buton2_hit"); overSkin: Embed(source="skin_registro.swf", symbol="boton2_over"); selectedDisabledSkin: Embed(source="skin_registro.swf", symbol="buton2_disable"); selectedDownSkin: Embed(source="skin_registro.swf", symbol="buton2_hit"); selectedOverSkin: Embed(source="skin_registro.swf", symbol="boton2_over"); selectedUpSkin: Embed(source="skin_registro.swf", symbol="boton2_up"); upSkin: Embed(source="skin_registro.swf", symbol="boton2_up"); } .button3 { disabledSkin: Embed(source="skin_registro.swf", symbol="buton3_disable"); downSkin: Embed(source="skin_registro.swf", symbol="buton3_hit"); overSkin: Embed(source="skin_registro.swf", symbol="boton3_over"); selectedDisabledSkin: Embed(source="skin_registro.swf", symbol="buton3_disable"); selectedDownSkin: Embed(source="skin_registro.swf", symbol="buton3_hit"); selectedOverSkin: Embed(source="skin_registro.swf", symbol="boton3_over"); selectedUpSkin: Embed(source="skin_registro.swf", symbol="buton3_up"); upSkin: Embed(source="skin_registro.swf", symbol="buton3_up"); } .button4 { disabledSkin: Embed(source="skin_registro.swf", symbol="boton4_disable"); downSkin: Embed(source="skin_registro.swf", symbol="buton4_hit"); overSkin: Embed(source="skin_registro.swf", symbol="boton4_over"); selectedDisabledSkin: Embed(source="skin_registro.swf", symbol="boton4_disable"); selectedDownSkin: Embed(source="skin_registro.swf", symbol="buton4_hit"); selectedOverSkin: Embed(source="skin_registro.swf", symbol="boton4_over"); selectedUpSkin: Embed(source="skin_registro.swf", symbol="buton4_up"); upSkin: Embed(source="skin_registro.swf", symbol="buton4_up"); } .button5 { disabledSkin: Embed(source="skin_registro.swf", symbol="boton5_disable"); downSkin: Embed(source="skin_registro.swf", symbol="boton5_hit"); overSkin: Embed(source="skin_registro.swf", symbol="boton5_over"); selectedDisabledSkin: Embed(source="skin_registro.swf", symbol="boton5_disable"); selectedDownSkin: Embed(source="skin_registro.swf", symbol="boton5_hit"); selectedOverSkin: Embed(source="skin_registro.swf", symbol="boton5_over"); selectedUpSkin: Embed(source="skin_registro.swf", symbol="buton5_up"); upSkin: Embed(source="skin_registro.swf", symbol="buton5_up"); } <!-- css code --> <!-- mxml code --> <mx:ToggleButtonBar dataProvider="{ViewStack1}" id="tbb1" itemClick="clickHandler(event);" enabled="false" /> <mxid="ViewStack1"> .... a set of 5 canvas </mx:ViewStack > <!-- mxml code --> <!--as code --> tbb1.getChildAt( 0).setStyle( 'styleName' ,'button1' ); tbb1.getChildAt( 1).setStyle( 'styleName' ,'button2' ); tbb1.getChildAt( 2).setStyle( 'styleName' ,'button3' ); tbb1.getChildAt( 3).setStyle( 'styleName' ,'button4' ); tbb1.getChildAt( 4).setStyle( 'styleName' ,'button5' ); <!--as code --> each button is different and is defined in the swf of the skin I have not tried setting into indivudal buttons, I will try that, but if I used them as this: .ToggleButtonBar2 { buttonStyleName: "button2"; firstButtonStyleName: "button1"; lastButtonStyleName: "button3"; } they work as it should, of course the middle buttons they all get button2. Thanks and sorry I didn't explained correctly. Terius Alex Harui wrote: > > You haven't explained what isn't working. Do you get an error? What > styles are you trying to set? Can you post a simple test case? Did > you try setting individual styles? Did you prove that you can set > those styles on a button outside of TBB and it works? > > ---------------------------------------------------------- > *From:* flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] > *On Behalf Of *Guillermo Villasana > *Sent:* Wednesday, October 03, 2007 4:08 PM > *To:* flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > *Subject:* Re: [flexcoders] Change style on each button on a > ToggleButtonBar > > Well, this is not working, not even temporarly. Any thoughts on who this > could be done in another way? > > Alex Harui wrote: > > > > The dataProvider is of type Object so you can pass it different kinds > > of data sets. > > > > The children are buttons, so getChildAt() will work, but the styleName > > property is used by the TBB to change the visuals for the selected > > button so doing what you propose probably should work temporarly then > > go away as you toggle buttons. Setting individual style properties > > like fontWeight or color should work though. > > > > ---------------------------------------------------------- > > *From:* flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > <mailto:flexcoders%40yahoogroups.com> > [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com>] > > *On Behalf Of *Sheriff > > *Sent:* Wednesday, October 03, 2007 2:26 PM > > *To:* flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > > *Subject:* Re: [flexcoders] Change style on each button on a > > ToggleButtonBar > > > > no i dont think its possible since the toggleButtons are not really > > buttons they are objects but i'd wait till somone else chines in. If > > you check the dataprovider of the toggleButtonBar then it just says > Object > > > > label="Button1" etc.. > > > > ----- Original Message ---- > > From: Guillermo Villasana <terius! @villasana.com.mx> > > To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%40yahoogroups.com> > > Sent: Wednesday, October 3, 2007 4:15:57 PM > > Subject: [flexcoders] Change style on each button on a ToggleButtonBar > > > > Is it possible to change the sytle of each button in a toggle buttonbar? > > I tried this... but it doesn't seem to work: > > > > MyTBB.getChildAt( 0).setStyle( 'styleName' ,'button1' ); > > MyTBB.getChildAt( 1).setStyle( 'styleName' ,'button2' ); > > MyTBB.getChildAt( 2).setStyle( 'styleName' ,'button3' ); > > MyTBB.getChildAt( 3).setStyle( 'styleName' ,'button4' ); > > > > what is wrong? > > Thanks > > > > > > > > ---------------------------------------------------------- > > Luggage? GPS? Comic books? > > Check out fitting gifts for grads > > > <http://us.rd.yahoo.com/evt=48249/*http://search.yahoo.com/search?fr=oni _on_mail&p=graduation+gifts&cs=bz <http://us.rd.yahoo.com/evt=48249/*http://search.yahoo.com/search?fr=oni _on_mail&p=graduation+gifts&cs=bz> > <http://us.rd.yahoo.com/evt=48249/*http://search.yahoo.com/search?fr=oni _on_mail&p=graduation+gifts&cs=bz <http://us.rd.yahoo.com/evt=48249/*http://search.yahoo.com/search?fr=oni _on_mail&p=graduation+gifts&cs=bz> >> > > > at Yahoo! Search. > > > >