Browse Source

Fixed loadingmanager bug in 'load' event listener

Make sure loadingmanager is aware of errors occured in 'load' event handler
Pontus Leitzler 9 years ago
parent
commit
8fabfa6852
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/loaders/XHRLoader.js

+ 5 - 3
src/loaders/XHRLoader.js

@@ -45,17 +45,19 @@ THREE.XHRLoader.prototype = {
 
 			THREE.Cache.add( url, response );
 
-			if ( this.status == 200 && this.readyState == 4 ) {
+			if ( this.status === 200 && this.readyState === 4 ) {
 
 				if ( onLoad ) onLoad( response );
 
+				scope.manager.itemEnd( url );
+
 			} else {
 
 				if ( onError ) onError( event );
 
-			}
+				scope.manager.itemError( url );
 
-			scope.manager.itemEnd( url );
+			}
 
 		}, false );