You didn't saw you were stringifying the bytearray. Made me wonder if you'd posted the right code or described your steps correctly. Did you try my steps? If they work, it would save you a few hops. An image is a Bitmap so converting to ByteArray should be single method calls and not a lot of work. FlashPlayer has an AMF restriction and can't deserialize properly in SWFs that aren't in the main app domain. So, it will probably take a number of hops but I think it should be less than you described.
Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: [email protected] [mailto:[email protected]] On Behalf Of rob_mcmichael Sent: Friday, April 10, 2009 3:27 AM To: [email protected] Subject: [flexcoders] Re: Marshall Plan: Loading images from byteArray > Your code didn't match the description. How so? I changed the names of the swfs, but other than that, that is the error I am getting when trying to load the bytearray of a PNG using a swf loader? > I'd take the bitmapdata, write it to a bytearray, pass the bytearray across > shared events, loadbytes the bytearray on the other side. > I have since worked on loading an image in the parent application, turning it into a bitmap, getting the pixels into another byte aray, converting that into a standard array, passing that through the shared events, back to byte array (plus the height and width and URL as an ID) then loading that back into a bitmap, and then adding that to a UI object to render.... It's a bit of a faff, but now it's written it appears to work fine. I am yet to see how easy bitmaps are to work with over standard images (scaling etc). I also tried using AMF to pass objects (image component) via the Marshall plan, but they didn't load back up correctly. I assume the Marshall plan is editing them as it would be a security breach right? If this is the only way to do it, I will try and write it up, and perhaps show some examples for how you could do it for other data types (audio and video). If you have any ideas or suggestions please let me know. Rob

