1 Reply Latest reply on Jan 9, 2007 3:44 PM by Opsware_Jeff

    Getting data driven images to render in a datagrid...

    Opsware_Jeff
      I can't get my data driven image to render in my datagrid...

      I have code that loads all my icons and makes them into classes. I've read this is a best practice. It looks like this:
      [@Embed(source="file:../Icons/compMgmt16.png")]
      [Bindable]
      public var compMgmt16:Class;

      I have a datagrid that renders my XML data. The XML data looks like this:
      <node label="Computer Management" icon="compMgmt16" viewStack="defaultView" />

      The datagrid looks like this:
      <mx:DataGrid dataProvider="{myXMLData}" >
      <mx:columns>
      <mx:DataGridColumn headerText="Icon" dataField="@icon >
      <mx:itemRenderer>
      <mx:Component>
      <mx:Image source="{data.@icon}" />
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
      <mx:DataGridColumn headerText="Name" dataField="@label" />
      </mx:columns>
      </mx:DataGrid>

      Why does this render the @label column correctly, but render a broken-picture image for the @icon ??? I use the image class vars (i.e. compMgmt16) successfully elsewhere in the app, so I know they are working in different contexts.

      Thanks so much,
      Jeff