|
@@ -6,29 +6,34 @@ THREE.ImageLoader = function () {
|
|
|
|
|
|
THREE.EventTarget.call( this );
|
|
|
|
|
|
- var _this = this;
|
|
|
+};
|
|
|
+
|
|
|
+THREE.ImageLoader.prototype = {
|
|
|
|
|
|
- this.crossOrigin = 'anonymous';
|
|
|
+ constructor: THREE.ImageLoader,
|
|
|
|
|
|
- this.load = function ( url ) {
|
|
|
+ crossOrigin: 'anonymous',
|
|
|
|
|
|
+ load: function ( url ) {
|
|
|
+
|
|
|
+ var scope = this;
|
|
|
var image = new Image();
|
|
|
|
|
|
image.addEventListener( 'load', function () {
|
|
|
|
|
|
- _this.dispatchEvent( { type: 'complete', image: image } );
|
|
|
+ scope.dispatchEvent( { type: 'complete', image: image } );
|
|
|
|
|
|
}, false );
|
|
|
|
|
|
image.addEventListener( 'error', function () {
|
|
|
|
|
|
- _this.dispatchEvent( { type: 'error', image: image } );
|
|
|
+ scope.dispatchEvent( { type: 'error', image: image } );
|
|
|
|
|
|
}, false );
|
|
|
|
|
|
image.crossOrigin = this.crossOrigin;
|
|
|
image.src = url;
|
|
|
|
|
|
- };
|
|
|
+ }
|
|
|
|
|
|
-};
|
|
|
+}
|