//swf,cpp:
var output = new haxe.io.BytesOutput();
for (i in 0...256) output.writeInt16(1);
var bytes = output.getBytes();
trace(bytes.length); // 512
var data = bytes.getData();
trace(data.length); // 512;
//js:
var output = new haxe.io.BytesOutput();
for (i in 0...256) output.writeInt16(1);
var bytes = output.getBytes();
trace(bytes.length); // 512
var data = bytes.getData();
trace(data.length); // ERROR: haxe.io.BytesData has no field length
trace(data.byteLength); // 609, should be 512
How to reproduce (Haxe 4.0.2):
- Compile first example with -swf or -cpp
- both bytes.length and data.length are correct
- Compile second example with -js
- first problem: length property is not defined
- second problem: switching to byteLength, it seems the internal buffer is returned instead of the actual written bytes