views:

436

answers:

5
+1  Q: 

Flash Screenshot

We're trying to send an image of a large SWF file to a server to have it mailed out and we're having a bit of trouble with transmission time.

The SWF is about 900px x 600px and restricted to AS2 so we've been using this Bitmap Exporter class. We've tried using several different ways to transmit the data; base10, base36 and base128 but none of them will send the file in any kind of timely manner.

Right now we're dealing with 60-120 seconds per image which isn't acceptable.

Has anyone any advice for dealing with either this class or another for sending large bitmap data to a server with flash?

Thank you for your time.

+1  A: 

The reason you get such long upload times is that the image is barely compressed (or not at all depending on how the class is implemented). 900 by 600 pixels at 16 bpp (or whatever it now is flash uses) amounts to something like 1.5mb of raw data.

I'm doubtful that there are any useful compression libraries for AS2, but that may be a possible path.

The easiest way to make the image smaller on the client side would be lowering the resolution. Are you using the full resolution once it reaches the server? If not that might be a possible way.

(I guess you're aware that this would be way easier using AS3, then you could compress the whole image as a jpeg clientside without very much effort, but I guess the rest of your application is AS2 making that a somewhat moot point)

grapefrukt
Yea, I'm limited to AS2 here unfortunately.I'm trying to lower the resolution as much as possible without losing image quality but anything that looks decent still has a terrible transfer rate. Thanks for the input!
A: 

You could also try using amfphp because it allows for binary serialization when sending data to server.

A: 

You will probably want to implement a simple RLE algorithm in AS2, if one does not already exist, to compress the bitmap. Assuming you have nice solid color vector elements, RLE should provide quite good compression.

Sparr
A: 

There's a couple good JPEG compression classes out there for as3, the one I use being googles: http://code.google.com/p/as3corelib/

You might be able to port that to as2...

UltimateBrent
A: 

Just a quick fly by and link - http://www.gskinner.com/blog/archives/2006/03/saving_bitmapda.html

edit - this may be helpful too! http://www.5etdemi.com/blog/archives/2006/10/the-ultimate-as2-bitmapdata-saving-solution/

Grant Skinner suggests downsampling the image data to a smaller colour palette, and then some runtime compression (he was leaning toward UTF-8 strings being compressed and then handling the image conversion elsewhere, I imagine the server)

UltimateBrent's link to a JPEG compression library sounds like a good, if not technically challenging, idea.

is colour pallete depth an issue? lossy compression?

can you send a bunch of variables to the server, recreate the image on a locally running swf, and then export it there? or are there just too many variables (like in a painting type program)? Like, say, if it's a make your own avatar sort of thing, you might be able to turn the settings into an XML and generate the image from that on the server. Dunno!

Assembler