Nevermind, I got it. You can do something like this:
<mx:Script>
<![CDATA[
private function dostuff() : void
{
var arritems : Array = new Array();
var item : Object = new Object();
item.label = "Flash";
item.icon = testWarning;
arritems.push( item );
item = new Object();
item.label = "Director";
item.icon = testWarning;
arritems.push( item );
tbb.dataProvider = arritems;
}
[Embed(source='/assets/picture.png')]
[Bindable]
public var testWarning : Class;
]]>
</mx:Script>
<mx:ToggleButtonBar
id="tbb"
iconField="icon"
labelField="label"
width="300"
creationComplete="dostuff()"
textAlign="left"
direction="vertical"/>
--- In [email protected], "leekuens" <[EMAIL PROTECTED]> wrote:
>
> Hello all. Seems that the only way that I've been able to accomplish
> embedding icons in a togglebuttonbar/buttonbar control is by doing the
> following:
>
> <mx:ToggleButtonBar id="tbb" iconField="icon" width="300"
> textAlign="left" direction="vertical">
> <mx:Array>
> <mx:Object label="Flash"
> icon="@Embed('/assets/picture.png')"/>
> <mx:Object label="Director"
> icon="@Embed('/assets/picture.png')"/>
> </mx:Array>
> </mx:ToggleButtonBar>
>
> In the above example, we specify the dataprovider as an Array in the
> mxml tags.
>
> Now if we try doing this in combination with actionscript:
>
> <mx:Script>
> <![CDATA[
> private function dostuff() : void
> {
> var arritems : Array = new Array();
> var item : Object = new Object();
> item.label = "Flash";
> item.icon = "@Embed('/assets/picture.png')";
> arritems.push( item );
>
> item = new Object();
> item.label = "Director";
> item.icon = "Embed('/assets/picture.png')";
> arritems.push( item );
> tbb.dataProvider = arritems;
> }
> ]]>
> </mx:Script>
>
> <mx:ToggleButtonBar
> id="tbb"
> iconField="icon"
> labelField="label"
> width="300"
> creationComplete="dostuff()"
> textAlign="left"
> direction="vertical"/>
>
> The icon dissappears. I'm wondering why there isn't an iconFuction tag
> in the togglebuttonbar/buttonbar components. I've tried doing several
> variations on the dataprovider and script and have not been able to
> embed the icon with exception to how I've shown at the begginning of
> this post.
>
> Is this a bug or is there a way to accomplish this in the method that
> I'm attempting? Thanks folks :)
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/