0

I have a question about getting an image from server. btw I'm using BlazeDS. And when I attempt to load it from loader it gives me "Loaded file is an unknown type." error message. Here's my code:

var loader:Loader = new Loader();
loader.loadBytes(SessionClientData.prsnl.resim); //it throws an exception here
img_doktor.source = Bitmap(loader.content);

SessionClientData.prsnl.resim is byte array.

Any suggestions? or Any other way of doing it?

Zaur Guliyev
  • 4,254
  • 7
  • 28
  • 44
  • What is the exception that is thrown? normally to display an image, I'd just use an image or BitMapImage component and set the source to the image's location. – JeffryHouser Jun 21 '12 at 11:19
  • It gives "Loaded file is an unknown type." exception.. I can't do as u say because I get images from a database - isn't there an easy way of doing this? – Zaur Guliyev Jun 21 '12 at 12:27

1 Answers1

0

Well, if it is only one image then simply load it as byte array (as you are already doing) and then assign it to source property of spark image component. When it would be done you will also get ready event from spark image component.

myImage.source = loadedByte (ByteArray you got).

Let me know if it helps.

akhil_mittal
  • 23,309
  • 7
  • 96
  • 95