pulse00
06-06-2008, 10:44 AM
Hi all,
i'm trying to read a binary file containing a sequence of floats created in C.
Loading and reading the file works fine in php, but i can't get this to work
in actionscript:
Here's my approach:
in the constructor:
...
this.loader = new URLLoader();
this.loader.dataFormat = URLLoaderDataFormat.BINARY;
var bin = new URLRequest("http://path/to/some/binary/file");
this.loader.load(bin);
this.loader.addEventListener(Event.COMPLETE, completeHandler);
...
public function completeHandler() {
var data : ByteArray = loader.data;
while (data.bytesAvailable > 0 ) {
trace(data.readFloat);
}
}
However, the values i get are wrong. They are way too small compared
to the real ones. Around 1.9893951235729634e-38 as they should be
something like 0.234894.
Does anyone see something obvious i might be missing out ?
Thanks for your help.
-pulse00
i'm trying to read a binary file containing a sequence of floats created in C.
Loading and reading the file works fine in php, but i can't get this to work
in actionscript:
Here's my approach:
in the constructor:
...
this.loader = new URLLoader();
this.loader.dataFormat = URLLoaderDataFormat.BINARY;
var bin = new URLRequest("http://path/to/some/binary/file");
this.loader.load(bin);
this.loader.addEventListener(Event.COMPLETE, completeHandler);
...
public function completeHandler() {
var data : ByteArray = loader.data;
while (data.bytesAvailable > 0 ) {
trace(data.readFloat);
}
}
However, the values i get are wrong. They are way too small compared
to the real ones. Around 1.9893951235729634e-38 as they should be
something like 0.234894.
Does anyone see something obvious i might be missing out ?
Thanks for your help.
-pulse00