1 Reply Latest reply: Sep 19, 2013 1:36 PM by Flex harUI RSS

    How do I reference the data object in a DataGrid to show an image correctly in Acrobat?

    DJH_EOS Community Member

      I'm creating an inferface for an Acrobat application  and I'm having a issue with displaying an image in a grid.  When I hard code the source="statusNONE.png" it works as intended (with an image, not the image associated with each grid item), however, when I try to use the source="{data.@icon}" to reference the dataProvider (XMLListCollection) I get nothing.  Not a broken image or anything.  I think I may just not be referencing the XMLListCollection correctly, otherwise I don't know why it would work with hard coding vs. fetching the string from the XML.


      //Application Header (Flex 4.5)


      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                       width="100%" height="100%" creationComplete="eaton_creationCompleteHandler(event)"


      //Sample of XML that gets used as basis for XMLListCollection

           <Annot name='TEST' index='14' feedback='' canConstruct='0' icon='statusNONE.png'/>


      //creation of the XMLListCollection from String


      [Bindable] protected var fullXML:XML;

      [Bindable] protected var fullXMLCol:XMLListCollection;


      protected function loadXML(xmlString:String):void


            fullXML = new XML(xmlString);

           var fullXMLList:XMLList = fullXML.children();

            fullXMLCol = new XMLListCollection(fullXMLList);




      <s:DataGrid left="0" top="0" bottom="0" width="142" dataProvider="{fullXMLCol}"
                                              requestedRowCount="4" rowHeight="30"
                                              <s:GridColumn dataField="@name" headerText="Annotations"></s:GridColumn>
                                              <s:GridColumn headerText="status" width="30" >
                                                                                      <s:Image width="30" height="30" source="{data.@icon}"/> //THIS IS THE PART THAT SEEMS TO BE GIVNG ME TROUBLE!
                                    <fx:Object dataField1="Sample Data" dataField2="Sample Data" dataField3="Sample Data"></fx:Object>


      Additional information.  I'm using the resources tab for the flash embedding in Acrobat for my images. This works when I am hard coding the file name string works for the source without having to add a full path, the images are not technically bundled into the swf.   I just don't understand why using the data object to get that same string would show different results.


      tl;dr: GridItemRenderer works to show images when hard coded but not when using {data}.


      UPDATE: Figured it out, needed to add a toString() to the data.@icon.   I had assumed it was a string being handed over, I assumed wrong.