1 Reply Latest reply on Jun 3, 2007 6:59 AM by JJ_Springer

    Setting the image source dynamically

      I am getting an xml response back from a server and am trying to bind the columns to the values of xml elements. I need to be able to bind the source of an image, but am at loss on how to do it. Here is my code so far:

      <mx:DataGrid x="21" y="252" id="dgResults" dataProvider="{response.SearchResultItemArray.SearchResultItem.Item}">
      <mx:DataGridColumn headerText="Title" labelFunction="{titleColumnLabelFunction}" />
      <mx:DataGridColumn headerText="Image" >
      <mx:Image />

      This is how I have defined my function titleColumnLabelFunction, which works fine:

      private function titleColumnLabelFunction(item:Object, column:DataGridColumn) : String {
      return item.Title;

      If I try to assign the source to a function similar to function titleColumnLabelFunction, it complains at design time with the following error:
      1120: Access of undefined property imageColumnLabelFunction.

      This is what the relevant portion of XML response looks like:
      <?xml version="1.0" encoding="UTF-8" ?>
      <GetSearchResultsResponse xmlns="urn:ebay:apis:eBLBaseComponents">
      <Title>Chuck E Cheese 1994 Cooper Test Token Chucky Chuckie</Title>
      <GalleryURL> http://thumbs.ebay.com/pict/120124817156.jpg</GalleryURL>

      It has multiple GetSearchResultItemArray nodes.

      Any help is appreciated.