2 Replies Latest reply on Dec 19, 2008 8:22 AM by Zee Yang

    Dynamic image display

      Hello Falks!
      I am new and novice to Flex platform and I jumped into Flex3. I have a good background of Java.
      I tried to make a sample application that reads data from mysql5.1 DB and displays on DataGrid columns.

      One of my table coumn is Image [BLOB]. When i try retriving it via Remote Object service with BlazeDS data service, it does not display me the Images.

      I am pasting the code of my MXML.
      -------------------------"Attached Code"------------------------------------------------------------------------------------ ------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      import flash.display.Bitmap;
      import mx.controls.Image;
      import mx.graphics.ImageSnapshot;
      import mx.graphics.codec.*;
      import mx.graphics.codec.JPEGEncoder;
      import mx.controls.Alert;

      import mx.collections.ArrayCollection;
      private var reviewList:ArrayCollection;
      import mx.controls.TileList;
      private var myTileList:TileList;

      private function getResults():void {

      reviewList = remoteobj.getPersonDetails.lastResult;

      var tf:TextFormat = new TextFormat();

      //set textFormat font, color, and size
      tf.font = "Verdana";
      tf.bold = true;
      tf.color = 0x990000;
      tf.size = 16;
      myTileList= new TileList();
      myTileList.dataProvider =reviewList[0].image as Bitmap;

      // set column and row values
      myTileList.columnWidth = 200;
      myTileList.rowHeight = 140;
      myTileList.columnCount = 1;
      myTileList.rowCount = 2;
      myTileList.width = 210;
      myTileList.height = 305;

      //set styles
      myTileList.setStyle("contentPadding", 5);

      // add to the display (Stage)


      <mx:RemoteObject id="remoteobj" destination="personmap" />
      <mx:Image id="img" />
      <mx:DataGrid id="dg" dataProvider="{reviewList}" >
      <mx:DataGridColumn dataField="person_id" headerText="PersonID" />
      <mx:DataGridColumn dataField="fname" headerText="FirstName"/>
      <mx:DataGridColumn dataField="lname" headerText="LastName"/>
      <mx:DataGridColumn headerText="Image">
      <mx:Image id="myImage"
      height="100" width="100"

      <mx:Button label="Get Data" click="getResults()"/>


      ------------------------------------------------------------------------------------------ -----------------------------------------------