sharing jpgs, do I need to convert my bitmapData to bytearray first?

23 views
Skip to first unread message

Andy Woods

unread,
Nov 6, 2013, 7:28:08 AM11/6/13
to cocoo...@googlegroups.com
Hi there,
hoping that I don't need to byterray flvs, pngs etc before I shareWithAll. 
I would really appreciate your tips on this issue.
best wishes,
Andy.

Jesse Warden

unread,
Nov 6, 2013, 7:54:04 AM11/6/13
to cocoo...@googlegroups.com
You can't send BitmapData over the wire, only ByteArrays. It is very fast, though, both in code and in network.


--
You received this message because you are subscribed to the Google Groups "Cocoon P2P" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cocoon-p2p+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Andy Woods

unread,
Nov 6, 2013, 8:40:19 AM11/6/13
to cocoo...@googlegroups.com
Thanks for getting back to me so fast!
Yep, been exploring this issue the last few hours.  I'm trying out this method:
cheers,
Andy.

Jesse Warden

unread,
Nov 6, 2013, 8:44:57 AM11/6/13
to cocoo...@googlegroups.com
I just used the JPG and PNG encoders that come with Flex:


Also, I scaled 'em down if they didn't fit, but this was just for slides, not really good looking pictures.

Also, that Zip library that Claus or whoever published is insanely easy to work with; you can very quickly put a bunch of images in the zip file, save it to disk, and just shuttle the ZIP over the wire. Obviously compression doesn't help much, but makes your code easier to read, heh.

Andy Woods

unread,
Nov 6, 2013, 9:04:18 AM11/6/13
to cocoo...@googlegroups.com
Got that code to work. In case useful to anyone, am attaching my class.  You pass bitmaps to saveImage(name, bitmap).  Once done, you receive your compiled compressed bytearray via bytearray().  At the receiver end, you uncompile your bytearray via bytearrayToStim(byteArray) and access your files via the toReceive_imgLibrary object.
Stimuli_ByteArray.as
Reply all
Reply to author
Forward
0 new messages