2 Replies Latest reply on Aug 26, 2009 2:43 AM by The Converted

    Display image then more data in a datagrid

    The Converted

      Hi,

       

      I've been using Flex for about a month and I'm impressed. Bit I've hit a bit of stumbling block.

       

      Sorry if my teminology is a little confused, I've populated a datagrid from a php file displaying xml.  I also want to show an image outside this datagrid which also takes info from the same xml file.  see below

       

      ########################################## data grid ########################################

       

      private var playlist:XML = new XML();           
                 
             
                  private function resultHandler(event:ResultEvent):void {
                      playlist = XML(event.result);
                      setUp();
                  }

       

      <mx:DataGrid width="100%" id="songsList" dataProvider="{playlist.song}" ;" selectedIndex="1" liveScrolling="true" verticalScrollPolicy="on"  height="111">
                  <mx:columns>
                              <mx:DataGridColumn width="100" headerText="Artist" dataField="artist"/>
                  <mx:DataGridColumn width="60" headerText="Song" dataField="title"/>
                  <mx:DataGridColumn width="30" headerText="Price" dataField="price"/>
                                          </mx:columns>
                          </mx:DataGrid>

       

      ########################################## xml ##################################################

       

      <songs><song><artist></artist><price></price><image></image><title></title><data></data></song></songs> 

      ######################################################################################################

      When I use <mx:Image source="{playlist.song.image}"> This doesn't produce an error but on compiling shows nothing.  I only want to show 1 picture per artist or album.

      I can't figure how to use a variable or get the xml value into the source.  I suppose I'm so used to PHP and asp it's
      I'm not seeing how it works in flex.  Is it confused because it sees lots of image values, in the xml.  Can I use the same xml do I need to create new PHP query to get another xml list.

      Thanks hope someone can put me straight, I hope I'm not coming across as too silly,

      Gavin