Skip to content

Commit

Permalink
Implemented supportsData() in AC3DParser. Closes #51
Browse files Browse the repository at this point in the history
  • Loading branch information
richardolsson committed Jun 1, 2011
1 parent 9bfe679 commit 55e5e3b
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/away3d/loaders/parsers/AC3DParser.as
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package away3d.loaders.parsers

import flash.geom.Vector3D;
import flash.net.URLRequest;
import flash.utils.ByteArray;

use namespace arcane;

Expand Down Expand Up @@ -72,7 +73,24 @@ package away3d.loaders.parsers
* @param data The data block to potentially be parsed.
* @return Whether or not the given data is supported.
*/
public static function supportsData(data : *) : Boolean {return false;}
public static function supportsData(data : *) : Boolean
{
var ba : ByteArray;
var str : String;

ba = data as ByteArray;
if (ba) {
ba.position = 0;
str = ba.readUTFBytes(4);
}
else {
str = (data is String)? String(data).substr(0, 4) : null;
}

if (str == 'AC3D')
return true;
return false;
}

/**
* @inheritDoc
Expand Down

0 comments on commit 55e5e3b

Please sign in to comment.