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.

Reply via email to