kottore / away3d

Automatically exported from code.google.com/p/away3d
0 stars 0 forks source link

Loader3D model load error #133

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. loading a collada *.dae file
2.
3.

What is the expected output? What do you see instead?
TypeError: Error #1009: Cannot access a property or method of a null object 
reference.

What version of the product are you using? On what operating system?
away3d 3.6

Please provide any additional information below.

solution:

file: away3d.loaders.Loader3D
line 478: var pathArray:Array = []; // var pathArray:Array; updated cause of 
error

Original issue reported on code.google.com by gla...@gmail.com on 28 Sep 2010 at 3:35

GoogleCodeExporter commented 8 years ago
Decided to learn about Away3d and just "suffered" from this as well, however 
I'd change Loader3D this way, replacing:

if(url.indexOf("/") != -1)
    pathArray = url.split("/");

pathArray.pop();

var path:String;

if(url.indexOf("/") != -1)
    path = (pathArray.length > 0)? pathArray.join("/") + "/" : pathArray.join("/");

with

var path:String;
if(url.indexOf("/") != -1) {
    pathArray = url.split("/");

    pathArray.pop();

    path = (pathArray.length > 0)? pathArray.join("/") + "/" : pathArray.join("/");
}

Just a small optimization... I haven't looked how mtlPath and texturePath are 
used, but I guess the following two ifs statements could be added inside this 
if as well...

Original comment by neverbi...@gmail.com on 30 Sep 2010 at 6:10