A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: ByteArray and ExternalInterface

  1. #1
    Junior Member
    Join Date
    Jul 2007
    Posts
    3

    ByteArray and ExternalInterface

    Hi,
    I have a bitmap data which I can convert to a byteArray and then encode to a png or jpg. In Apollo i can save the png to disc.

    I now need to do the same in a C# desktop application. I have used externalInterface to communicate between flash and the c# but it serialises all data as XML and cannot serialise a byteArray. I have seen examples that use AMF or a socket to communicate with a server but I dont think method will work for communicating with a desktop app. Is there any way of converting a byteArray into a string to be send to the c# and decoded?
    Or is there any other method?

    help on this would be much appreciated as i am v. curfudled

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    You can base64 encode it, then send that as a plain string to be decoded later. This will inflate the size a bit, but probably not more than about 10%. I found a base64 actionscript library a while back and will link it here in a minute.

  3. #3
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I'm not sure if this is the same one I downloaded before. There appear to be a few of them out there: http://dynamicflash.com/2006/09/acti...ncoderdecoder/

    Regardless, I used mine to do a proof of concept where I could png or jpg encode a bitmap, then export it to the hosting webpage with javascript, to be rendered there as a plain graphic.

  4. #4
    Junior Member
    Join Date
    Jul 2007
    Posts
    3
    Amazing! I was going round in circles. will work on this now but think your solution will do the trick. Thank you so much 5Tons - brilliant!

  5. #5
    Junior Member
    Join Date
    Jul 2007
    Posts
    3
    It worked! now the flash can tell the desktop app to save an image to the hard drive. nice. thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center