better do it in Actionscript. Use either the
initialize or the updateComplete events to trigger
your itemrenderer change... also consider that you cnt
set a string as the itemrenderer like what you
'seemingly' do in mxml. you wil have to use a
classfactory to be able to use the class/UIcomponent
you want. Moreover,depending on where and when you set
your itemrenderer, you  may have to invoke
invalidateproperties(), invalidatesize(), and/or
updatedisplaylist. 


--- northwood Lee <[EMAIL PROTECTED]> wrote:

> Suppose the dataprovider has two field:
> type and text
> type will indicate if it should show text or image
> text is the content that is should show: for the
> label, it is the text  for
> the image it is the image path .or you can implement
> another filed callled
> path to store image path. it doesn't matter
> 
> I think you could write a  something like this:
> 
>            <mx:DataGridColumn headerText=" "
> width="28" dataField="icon" >
>                 <mx:itemRenderer >
>                     <mx:Component>
>                       <mx:HBox  width="400"
> height="300">
>                         <mx:Text
> text="{this.data.text}" visible="{
> this.data.type=='text'}"/>
>                          <mx:Image
> source="{this.data.text}" visible="{
> this.data.type!='text'}"/>
> 
>                           </mx:HBox>
>                     </mx:Component>
>                 </mx:itemRenderer>
>             </mx:DataGridColumn>
> 
> On 1/26/07, sthdejavu <[EMAIL PROTECTED]>
> wrote:
> >
> >   I am trying to create an MXML ItemRenderer that
> displays a different
> > state depending on it's data. Its state does not
> change by any user
> > interaction. For instance, if data.type = 'text',
> show the label
> > state, else show the image state.
> >
> > Where can I set currentState so that each
> itemRenderer displays as it
> > should? Is this even possible? All of my renderers
> always turn out
> > one way or the other.
> >
> > I'm beginning to think I have to do this in
> ActionScript... or maybe a
> > hack where I fire a function on creationComplete
> that changes the
> > data.type to some other value and back again so
> that the binding fires??
> >
> > Any help would be great. Thanks in advance.
> >
> >  
> >
> 



 
____________________________________________________________________________________
Never Miss an Email
Stay connected with Yahoo! Mail on your mobile.  Get started!
http://mobile.yahoo.com/services?promote=mail

Reply via email to