You can use the Loader class.
If your image is Base64 encoded, decode it first, if not, skip that part and 
use the Loader only.
Here's something I'm using to display BLOB images stored in an SQLite DB (AIR).

I've skipped a few things, but should get you going.
The important part is that you use a Loader instance to transform the ByteArray 
into a Bitmap instance.

 <mx:Script>
  <![CDATA[

   import mx.utils.Base64Decoder;
   import mx.utils.Base64Encoder;
   import mx.graphics.codec.JPEGEncoder;

   private function decodeImages():void {
    var decoder:Base64Decoder = new Base64Decoder();
    // imgData is the Base64 encoded image
    decoder.decode(imgData);
    var imgBA:ByteArray = decoder.toByteArray();
    var loader:Loader = new Loader();
    loader.loadBytes(imgBA);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, 
loaderCompleteHandler);
  }

   private function loaderCompleteHandler(evt:Event):void {
    // display the image
    db_img.source = evt.currentTarget.content as Bitmap;
   }

  ]]>
 </mx:Script>

<mx:Image id="db_img" />



----- Original Message ----- 
From: "Jon Santos" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Saturday, April 12, 2008 2:01 PM
Subject: Re: [flexcoders] How to download a BLOB from database....using Java


Hi Jim.....i know how to get the image in my POJO.....

The process i´m following:

I get the image form database throw my servlet. In this class i get the 
ImageObject (POJO), it means the image and other data.
In my FLEX application i have one object ImageObject (Action Script)....like 
Remote Object for the java object....then i able to get 
the image and the other data in my FLEX application....

The unique problem i´m finding : I don´t know how to display in my FLEX 
application (it means your B question).....i don´t know 
which component i must use to display my image (array of bytes).....

Thanks in advance....and i hope u already understad my problem.


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

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to