5 Replies Latest reply on Mar 23, 2007 12:48 AM by ankmit

    Help in making this example work

    ankmit
      hi,
      i am facing a problem in displaying dynamic images. i am pasting my MXML code. This code is not returning any error but still not working. in this example when i click on the grid the image control should take its source from the clicked column.

      <?xml version="1.0"?>
      <!-- itemRenderers\inline\InlineDGRenderer.mxml -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">

      <mx:Script>
      <![CDATA[

      import mx.collections.ArrayCollection;

      // Variable in the Application scope.
      public var localVar:String="Application localVar";

      // Data includes URL to album cover.
      [Bindable]
      private var initDG:ArrayCollection = new ArrayCollection([
      {Artist:'Pavement', Album:'Slanted and Enchanted',
      Price:11.99, Cover:'images/telephia_logo.jpg'},
      {Artist:'Pavement', Album:'Brighten the Corners',
      Price:11.99, Cover:'telephia_logo.jpg'}
      ]);

      // Retrieve the image associated with the item selected in the grid.
      private function getImage():void {
      var cartGrid:DataGrid = dgrid;
      var imageSource:String = 'images/' + cartGrid.selectedIndex;
      image1.load(imageSource);
      }
      ]]>
      </mx:Script>
      <mx:DataGrid id="dgrid" dataProvider="{initDG}"
      variableRowHeight="true" change="getImage();">

      <mx:columns>
      <mx:DataGridColumn dataField="Cover"/>
      </mx:columns>

      </mx:DataGrid>


      <mx:Image width="150" height="100" id="image1" source="imagesource"/>

      </mx:Application>

      please tell me how this could be made working also if some one has a similar working example please tell me. my requirment is to display images and the path should be taken from the grid column