LoaderWorker
| Kind of class: | class |
|---|---|
| Inherits from: | Dispatcher |
| Author: | Arthur Clemens, Martijn de Visser, added check for already loaded movies. These are now unloaded first., Martijn de Visser, implemented MovieClipLoader instead of MovieClip.loadMovie - major refactoring of code. |
| Classpath: | org.asapframework.util.loader.LoaderWorker |
| File last modified: | Sunday, 05 November 2006, 11:27:17 |
Used internally by Loader.
Events broadcasted to listeners:
- LoaderWorkerEvent with type:
ON_ERROR- (null)
- LoaderWorkerEvent with type:
ON_PROGRESS- (null)
Nothing, not yet implemented.Nothing, not implemented.- LoaderWorkerEvent with type:
ON_DONE- (null)
Summary
Constructor
- LoaderWorker (inNumber:Number)
- Creates a new LoaderWorker object.
Class properties
- TIMEOUT : Number
- Initial timeout when waiting for data from server (10 seconds).
Instance properties
- mNumber : Number
- Loader's worker number, counting from zero (used for debugging).
- mLoadingState : Boolean
- mLoadingData : FileData
- mLoader : MovieClipLoader
- loading : Boolean
- The loading state of the worker, true: the worker is currently loading; false: the worker has not yet started loading, or has finished or has encountered an error.
- loadingData : FileData
- The FileData object.
Instance properties inherited from Dispatcher
Instance methods
- load (inData:FileData) : Void
- Starts loading content
- stopLoading : Void
- Stops loading the asset
- sendDoneMessage : Void
- resetState : Void
- Resets the state of this worker
- startLoading : Void
- Starts the actual loading process
- unloadContent (inStart:Boolean) : Void
- Unloads the current movie if a movie was already loaded in mc
- toString : String
Event handlers
- onLoadError (target_mc:MovieClip, errorCode:String, httpStatus:Number) : Void
- Invoked when a file loaded with MovieClipLoader.loadClip() has failed to load.
- onLoadProgress (target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) : Void
- Invoked every time the loading content is written to the hard disk during the loading process (that is, between MovieClipLoader.onLoadStart and MovieClipLoader.onLoadComplete).
- onLoadInit (target_mc:MovieClip) : Void
- Invoked when the actions on the first frame of the loaded clip have been executed.
- onLoadStart (target_mc:MovieClip) : Void
- Invoked when a call to MovieClipLoader.loadClip() has begun to download a file.
- onLoadComplete (target_mc:MovieClip, httpStatus:Number) : Void
- Invoked when a file that was loaded with MovieClipLoader.loadClip() is completely downloaded.
Constructor
LoaderWorker
function LoaderWorker (
inNumber:Number)
Creates a new LoaderWorker object.
Class properties
TIMEOUT
static private TIMEOUT:Number = 10000
(read)
Initial timeout when waiting for data from server (10 seconds).
Instance properties
loading
loading:Boolean
(read)
The loading state of the worker, true: the worker is currently loading; false: the worker has not yet started loading, or has finished or has encountered an error.
mLoader
private mLoader:MovieClipLoader
(read)
mLoadingData
mLoadingState
private mLoadingState:Boolean = false
(read)
mNumber
private mNumber:Number
(read)
Loader's worker number, counting from zero (used for debugging).
Instance methods
resetState
private function resetState (
) : Void
Resets the state of this worker
sendDoneMessage
private function sendDoneMessage (
) : Void
Events broadcasted to listeners:
- LoaderWorkerEvent with type:
ON_DONE- (null)
startLoading
private function startLoading (
) : Void
Starts the actual loading process
stopLoading
function stopLoading (
) : Void
Stops loading the asset
toString
function toString (
) : String
Returns:
- Package and class name
unloadContent
private function unloadContent (
inStart:Boolean) : Void
Unloads the current movie if a movie was already loaded in mc
Parameters:
start:
, set to true to start loading new content after 1 frame dealy
Event handlers
onLoadComplete
function onLoadComplete (
target_mc:MovieClip,
httpStatus:Number) : Void
Invoked when a file that was loaded with MovieClipLoader.loadClip() is completely downloaded.
Events broadcasted to listeners:
Nothing, not implemented.
onLoadError
function onLoadError (
target_mc:MovieClip,
errorCode:String,
httpStatus:Number) : Void
Invoked when a file loaded with MovieClipLoader.loadClip() has failed to load.
Events broadcasted to listeners:
- LoaderWorkerEvent with type:
ON_ERROR- (null)
onLoadInit
function onLoadInit (
target_mc:MovieClip) : Void
Invoked when the actions on the first frame of the loaded clip have been executed.
onLoadProgress
function onLoadProgress (
target_mc:MovieClip,
loadedBytes:Number,
totalBytes:Number) : Void
Invoked every time the loading content is written to the hard disk during the loading process (that is, between MovieClipLoader.onLoadStart and MovieClipLoader.onLoadComplete).
Events broadcasted to listeners:
- LoaderWorkerEvent with type:
ON_PROGRESS- (null)
onLoadStart
function onLoadStart (
target_mc:MovieClip) : Void
Invoked when a call to MovieClipLoader.loadClip() has begun to download a file.
Events broadcasted to listeners:
Nothing, not yet implemented.