Hi,
I noticed that certain md2 files that did not have frame names that
ended in 3 digits would sometimes fail to load animations correctly.
It appears that MovieMesh::addFrame assumes that all frames will have
a 3 digit number which is not always the case with off the shelf md2s.
I've used the code below and it seems to have allowed support for more
md2s. I apologize if there's a better way to do the char comparison in
actionscript.
Thanks,
George
/**
* Adds a new frame to the animation timeline.
*/
public function addFrame(frame:Frame):void
{
var _name:String; // = frame.name.slice(0,
frame.name.length - 3);
var l_zero:String = "0";
var l_nine:String = "9";
var l_index:int = (frame.name.length - 1);
while (l_index >= 0)
{
var l_char:int = frame.name.charCodeAt(l_index);
if (false == ((l_char >= l_zero.charCodeAt(0))
&& (l_char <=
l_nine.charCodeAt(0))) )
break;
l_index--;
}
_name = frame.name.slice(0, (l_index + 1));
trace("Frame: " + frame.name + " vs " + _name);
if (!labels[_name])
labels[_name] = {begin:framesLength,
end:framesLength};
else
++labels[_name].end;
frames.push(frame);
framesLength++;
}