A minimal example:
import haxe.io.Bytes;
import haxe.io.UInt8Array;
import haxe.io.UInt16Array;
class Test {
static function main() {
var data8 = UInt8Array.fromArray([for (i in 0...10) i]);
var data16:UInt16Array = cast data8;
var bytes:Bytes = data8.view.buffer;
trace(data8[0]);
trace(data16[0]);
trace(bytes.get(0));
bytes.set(0, 0xFF);
trace(data8[0]);
trace(data16[0]);
trace(bytes.get(0));
}
}
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
import haxe.io.Bytes;import js.html.Uint8Array;
class Test { static function main() { var data8 = new Uint8Array([for (i in 0...10) i]); var bytes:Bytes = Bytes.ofData(data8.buffer); trace(data8[0]); trace(bytes.get(0)); bytes.set(0, 0xFF); trace(data8[0]); trace(bytes.get(0)); }}