March 23rd, 2012, 08:12 AM
Typed arrays and the DataView class
But I cannot get it working at all. I tried with the latest Chrome, Safari and IE10-preview browsers. Firefox did not seem to implement DataView at all.
I tried searching the forum to no avail and the only thing Google drew up was some example from Microsoft for IE10 that seems to indicate what I am doing should have worked.
This is a minimal example of the code I cannot get to work:
I always get zero but I would have expected a non zero value (67305985 which is 0x04030201 in hex).
var buffer = new ArrayBuffer(4);
buffer = 0x01;
buffer = 0x02;
buffer = 0x03;
buffer = 0x04;
var view = new DataView(buffer);
Can anyone explain what is happening here?
Thanks in advance for any help,
March 23rd, 2012, 09:35 AM
Aha forget that.
I just realized you cannot set the content of an ArrayBuffer using array-like methods, you actually have to use DataView for that also.
Sorry about the noise.