[haXe] Best way to send byte array

Nicolas Cannasse ncannasse at motion-twin.com
Thu Dec 14 19:03:15 CET 2006


> Thanks Nicolas,
>   The Application is going to be on the web as well as a standalone
> (using swhx) and I am trying to keep as much of the functionality inside
> the swf as possible.  I tried the byteArray.toString() and passing as
> string; that didn't work, either.  Is the communication between SWHX and
> Flash limited to String?
> 
> Thanks
> Hosey

You can send any base type (Int, Float, String...) and custom classes
that are based on these types. Native classes (Sound, MovieClip,
ByteArray) can't be send because there is no known equivalent in Neko.

The problem is that toString() will certainly throw an exception because
binary data don't match an UTF8 string. Maybe it would be most easy to
turn the ByteArray into an Array<Int> (0...255 values) and send that
Array using SHWX that will write the bytes one-by-one into the file.

Nicolas



More information about the Haxe mailing list