most definately, just loop thru the dataprovider during the 
ToggleButtonBar's initialize or creationComplete event ....and set 
each button's icon.

-- In flexcoders@yahoogroups.com, "markgoldin_2000" 
<markgoldin_2...@...> wrote:
>
> Yeah, I see it now too.
> Do think it's possible to set an icon for a button at run time?
> 
> --- In flexcoders@yahoogroups.com, "bhaq1972" <mbhaque@> wrote:
> >
> > i'm no expert but i'd suggest not using XML as the 
> > dataprovider....only because of what the docs say and looking at 
> the 
> > code prior to line 378 in NavBar.as
> > 
> > I modified your dataprovider to look like this
> > 
> > <mx:dataProvider>
> >  <mx:Array>
> >   <mx:Object id="b4" label="G2" online="true" icon="@Embed..."/>
> > etc..
> >  </mx:Array>
> > </mx:dataProvider>
> > 
> > And it works fine.
> > 
> > 
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "markgoldin_2000" 
> > <markgoldin_2000@> wrote:
> > >
> > > Still can't understand why the following does not work:
> > > code:
> > > <mx:ToggleButtonBar id="floorlines" direction="vertical" 
> > > iconField="icon" 
> > >                   horizontalGap="5" itemClick="clickHandler
> > > (event);" labelField="label"
> > >                   creationComplete="floorLinesData();" 
> > >                   height="100%" fontSize="8" fontWeight="bold"/>
> > > 
> > > data:
> > > <root>
> > >   <lines>
> > >     <id>4</id>
> > >     <label>G2</label>
> > >     <online>true</online>
> > >     
> > <icon>"@Embed('D:/projects/sfcs/assets/status_online.png')"</icon>
> > >   </lines>
> > >   <lines>
> > > </root>
> > > 
> > > code:
> > > floorlines.dataProvider = resultXML.lines;
> > > 
> > > error:
> > > Error: ERROR: The dataProvider of 'floorlines' must not contain 
> > > objects of type flash.display.DisplayObject.
> > >   at mx.controls::NavBar/set dataProvider()[C:\autobuild\3.2.0
> > > \frameworks\projects\framework\src\mx\controls\NavBar.as:378]
> > >   at tasktracking/floorLinesShowData()
> > > [D:\projects\sfcs\tasktracking\src\tasktracking.mxml:107]
> > >   at modulecode::Classes/httpResult()
> > > [D:\projects\sfcs\UFDCommonLib\src\modulecode\Classes.as:62]
> > >   at flash.events::EventDispatcher/dispatchEventFunction()
> > >   at flash.events::EventDispatcher/dispatchEvent()
> > >   at 
> > > 
> > 
> 
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::di
> > > spatchRpcEvent()[C:\autobuild\3.2.0
> > > \frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:170]
> > >   at 
> > > 
> > 
> 
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::re
> > > sultHandler()[C:\autobuild\3.2.0
> > > \frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:193]
> > >   at mx.rpc::Responder/result()[C:\autobuild\3.2.0
> > > \frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
> > >   at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0
> > > \frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
> > >   at DirectHTTPMessageResponder/completeHandler()
> > > [C:\autobuild\3.2.0
> > > 
> > 
> 
\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.a
> > > s:403]
> > >   at flash.events::EventDispatcher/dispatchEventFunction()
> > >   at flash.events::EventDispatcher/dispatchEvent()
> > >   at flash.net::URLLoader/onComplete()
> > > 
> > > Thanks
> > >
> >
>



Reply via email to