| Package | gs.preloading |
| Class | public final class Preloader |
| Inheritance | Preloader flash.events.EventDispatcher |
It provides you with methods for starting, stopping, pausing, resuming and prioritizing of assets, and registers all loaded assets with the asset manager.
By default, the Preloader loads all swf's and bitmap's into the same application domain. Unless specified otherwise in the constructor.
Examples are in the guttershark repository.
See also
| Property | Defined by | ||
|---|---|---|---|
| kbps : Number [read-only]
Kilobytes per second of the currently loading asset.
| Preloader | ||
| lastCompletedAsset : Asset
[read-only]
The last completed asset.
| Preloader | ||
| numLeft : int [read-only]
The number of items left in the preload queue.
| Preloader | ||
| percentLoaded : Number [read-only]
| Preloader | ||
| pixelsFull : Number
Returns the pixels full, based off of how much
has downloaded, and how many pixelsToFill.
| Preloader | ||
| pixelsToFill : int
The number of pixels that should be filled.
| Preloader | ||
| working : Boolean [read-only]
Indicates whether or not this controller is doing any preloading.
| Preloader | ||
| Method | Defined by | ||
|---|---|---|---|
|
Preloader(pixelsToFill:int = 100, loaderContext:LoaderContext = null)
Constructor for Preloader instances.
| Preloader | ||
|
addItems(items:Array):void
Add items to the controller to load - if the preloader is currently working,
these items will be appended to the items to load.
| Preloader | ||
|
addPrioritizedItems(items:Array):void
Add items to the controller to load, with top priority.
| Preloader | ||
|
dispose():void
Dispose of this preloader.
| Preloader | ||
|
pause():void
Pause the preloader.
| Preloader | ||
|
prioritize(asset:Asset):void
Prioritize an asset.
| Preloader | ||
|
reset():void
Resets internal state so the Preloader
can be re-used if needed.
| Preloader | ||
|
start():void
Starts loading the assets, and resumes loading from a stopped state.
| Preloader | ||
|
stop():void
Stops the preloader and closes the current loading assets.
| Preloader | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched for each asset that has completed downloading. | Preloader | |||
| Dispatched for each asset that has has stopped downloading because of an error. | Preloader | |||
| Dispatched for each asset that has started downloading. | Preloader | |||
| Dispatched for each asset that is downloading. | Preloader | |||
| Dispatched for each asset that generated an http status code other than 0 or 200. | Preloader | |||
| Dispatched when the Preloader completes downloading all assets in the queue. | Preloader | |||
| Dispatched on progress of the entire Preloader progress. | Preloader | |||
| kbps | property |
kbps:Number [read-only]Kilobytes per second of the currently loading asset.
Implementation public function get kbps():Number
| lastCompletedAsset | property |
lastCompletedAsset:Asset [read-only]The last completed asset.
Implementation public function get lastCompletedAsset():Asset
| numLeft | property |
numLeft:int [read-only]The number of items left in the preload queue.
Implementation public function get numLeft():int
| percentLoaded | property |
percentLoaded:Number [read-only]Implementation
public function get percentLoaded():Number
| pixelsFull | property |
pixelsFull:Number [read-write]Returns the pixels full, based off of how much has downloaded, and how many pixelsToFill. For example - if the pixels to fill is 100, and 10% of the download is complete, this will return 10.
Implementation public function get pixelsFull():Number
public function set pixelsFull(value:Number):void
| pixelsToFill | property |
pixelsToFill:int [read-write]The number of pixels that should be filled.
Implementation public function get pixelsToFill():int
public function set pixelsToFill(value:int):void
| working | property |
working:Boolean [read-only]Indicates whether or not this controller is doing any preloading.
Implementation public function get working():Boolean
| Preloader | () | constructor |
public function Preloader(pixelsToFill:int = 100, loaderContext:LoaderContext = null)Constructor for Preloader instances.
ParameterspixelsToFill:int (default = 100) — The total number of pixels this preloader needs to fill - this is used in calculating both pixels and percent.
|
|
loaderContext:LoaderContext (default = null) — The loader context for all assets being loaded with this Preloader.
|
| addItems | () | method |
public function addItems(items:Array):voidAdd items to the controller to load - if the preloader is currently working, these items will be appended to the items to load.
Parametersitems:Array — An array of Asset instances.
|
| addPrioritizedItems | () | method |
public function addPrioritizedItems(items:Array):voidAdd items to the controller to load, with top priority.
Parametersitems:Array — An array of Asset instances.
|
| dispose | () | method |
public function dispose():voidDispose of this preloader.
| pause | () | method |
public function pause():voidPause the preloader.
The current item will finish loading but not continue until you start it again.
| prioritize | () | method |
public function prioritize(asset:Asset):voidPrioritize an asset.
Parametersasset:Asset — An asset instance that's in the queue to be loaded.
|
| reset | () | method |
public function reset():voidResets internal state so the Preloader can be re-used if needed.
| start | () | method |
public function start():voidStarts loading the assets, and resumes loading from a stopped state.
| stop | () | method |
public function stop():voidStops the preloader and closes the current loading assets.
| assetComplete | event |
gs.events.AssetCompleteEvent
Dispatched for each asset that has completed downloading.
| assetError | event |
gs.events.AssetErrorEvent
Dispatched for each asset that has has stopped downloading because of an error.
| assetOpen | event |
| assetProgress | event |
gs.support.preloading.events.AssetProgressEvent
Dispatched for each asset that is downloading.
| assetStatus | event |
gs.events.AssetStatusEvent
Dispatched for each asset that generated an http status code other than 0 or 200.
| complete | event |
flash.events.Event
Dispatched when the Preloader completes downloading all assets in the queue.
| preloadProgress | event |
gs.events.PreloadProgressEvent
Dispatched on progress of the entire Preloader progress.