+ };\r
+\r
+function X_ImgLoader_detect(){\r
+ var raw = this[ '_rawObject' ];\r
+ \r
+ if( this.finish ) return;\r
+ if( raw && raw.complete ){\r
+ this._busy = false;\r
+ this.finish = true;\r
+ console.log( 'X.Net.Image:detect ' + raw.width );\r
+ if( raw.width ) return;\r
+ X_Timer_remove( this.timerID );\r
+ this.timerID = this[ 'asyncDispatch' ]( X_EVENT_ERROR );\r
+ } else\r
+ if( this.timeout < ( this.tick += this.delay ) ){\r
+ this._busy = false;\r
+ this.finish = true;\r
+ X_Timer_remove( this.timerID );\r
+ this.timerID = this[ 'asyncDispatch' ]( { type : X_EVENT_ERROR, 'timeout' : true } );\r
+ };\r
+};\r
+\r
+function X_ImgLoader_handleEvent( e ){\r
+ var size;\r
+ \r
+ console.log( 'X.Net.Image:handleEvent ' + e.type );\r
+ \r
+ switch( e.type ){\r
+ case 'error' :\r
+ //case 'abort' : // TODO ??\r
+ if( this.finish ) return;\r
+ this._busy = false;\r
+ this.finish = true;\r
+ this.timerID && X_Timer_remove( this.timerID );\r
+ this.timerID = this[ 'asyncDispatch' ]( /*e.type === 'error' ?*/ X_EVENT_ERROR /*: X_EVENT_CANCELED*/ );\r
+ break;\r
+\r
+ case 'load' :\r
+ // if( finish === true ) return; // これがあると firefox3.6 で駄目、、、\r
+ // if( timer ) return; // これがあると safari3.2 で駄目、、、\r
+ this._busy = false;\r
+ this.finish = true;\r
+ this.timerID && X_Timer_remove( this.timerID );\r
+ if( X_UA[ 'Opera' ] && !this[ '_rawObject' ].complete ){\r
+ this.timerID = this[ 'asyncDispatch' ]( X_EVENT_ERROR );\r
+ return;\r
+ };\r
+\r
+ size = X_Util_Image_getActualDimension( !X_ImgLoader_isElement ? this.abspath : this );\r
+ this.timerID = this[ 'asyncDispatch' ]( {\r
+ 'type' : X_EVENT_SUCCESS,\r
+ 'src' : this.abspath,\r
+ 'w' : size[ 0 ],\r
+ 'h' : size[ 1 ]\r
+ // TODO feedback net speed\r
+ // time , this[ '_rawObject' ].fileSize\r
+ } );\r
+ break;\r
+\r
+ case X_EVENT_KILL_INSTANCE :\r
+ this.reset();\r
+ break;\r
+ };\r
+};\r