4 Replies Latest reply on Mar 31, 2008 10:55 PM by Sreenivas R

    DataGrid Image Renderer and VBox

    alex-party
      Hi, I'm new to Flex,
      I've spent days and tried hundreds of examples, but nothing close to what I'm doing.
      Basically, I'm trying to load xml filelist and draw thumbnails on the screen.

      Here is xml:
      <?xml version="1.0" encoding="ISO-8859-1" ?>
      <rows>
      <row><image>_ http://localhost/_flex/images/archive/num_1.jpg</image_></row>
      <row><image>_ http://localhost/_flex/images/archive/num_2.jpg</image_></row>
      </rows>

      Flex Code:
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="init();">
      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;
      import mx.rpc.events.FaultEvent;
      import mx.controls.Alert;

      public var imageRows:ArrayCollection = null; // application global
      public function handleResultXML(event:ResultEvent):void {
      if(event.result && event.result.rows){
      var rows:Object = event.result.rows;
      if(rows.row){ //meaning only one row returned
      imageRows = new ArrayCollection([rows.row]);
      }else{
      imageRows = rows.row as ArrayCollection;
      }
      }
      }
      public function handleFault(event:FaultEvent):void {
      debug.text = "Fault: " + event.fault.faultDetail;
      }
      private function init():void{ srv.send(); }
      ]]>
      </mx:Script>


      <mx:HTTPService id="srv" url=" http://localhost/_flex/_vars.php" method="POST" result="handleResultXML(event)" fault="handleFault(event)" useProxy="false" resultFormat="e4x"/>
      <mx:VBox>
      <mx:Image source="{data.image}"/>
      </mx:VBox>

      .............

      I can't make it work anything I tried, please help.
      Thanks,
      Alex