PDA

View Full Version : transmitting image from application to flash


codeycody
01-15-2009, 10:38 PM
Hi everyone,

I'm trying to send a specific image (extracted from a png file using C#), from a C# application to the flash player.

I do this by:

-extracting the ARGB (Alpha,Red,Green,Blue) values of image
-storing these in a byte array
-transferring to the flash player using sockets
-using LoadBytes to read the ByteArray

LoadBytes however gives me an error message "unknown file type".

Now, I'm guessing that this could be because the bytes are not encoded as png. (I don't know how to do this)

Can anyone help me? Are there any easy ways to do this??

(And no, I can't use load with the url)

Thanks

codeycody
01-16-2009, 08:42 AM
The problem has been solved. :)

For future reference:
-I read the byte array sent by the other application into a bytearray (as explained earlier)
-I then created a new BitmapData constructor (I had to pass the width and height of the image as well)
-I used setPixels() and passed the byte array to fill in the bitmapdata

Hope that help anyone else.

Thanks anyway.