Package | com.sibirjak.angara.monitor |
Class | public class Monitor |
Inheritance | Monitor ![]() ![]() |
Implements | IMonitor |
The monitor holds an internal map to track the progress of its added loader item objects. The progress will be calculated incrementally to achieve the best possible performance. In order to do so, the monitor calculates the differences between two states of a loader item and adds this difference to the overall progress properties.
Generally the overall progress is the arithmetic average of all items added. It is though possible to give each element a specific weight. This can be useful for displaying a progress bar respecting the different sizes of the particular resources.
Adding a sequence uses its numItems property to calculate the weight of the sequence within the monitor. So adding one resource loader and a sequence of 3 items would this way result in a cumulative weight of 4. Finishing the sequence would change the monitor's progress to .75 then.
Sequences uses an internal monitor to calculate the sequence progress.
Method | Defined by | ||
---|---|---|---|
Monitor()
Creates a new monitor.
| Monitor | ||
add(loaderItem:ILoaderItem, weight:uint = 0):void
Adds a loader item to a progress monitor.
| Monitor | ||
clear():void
Removes all loader item references from the progress monitor.
| Monitor | ||
remove(loaderItem:ILoaderItem):void
Removes a loader item from the progress monitor.
| Monitor | ||
toString():String
Info
| Monitor |
Method | Defined by | ||
---|---|---|---|
dispatchMonitorComplete():void
Dispatches the MonitorEvent.COMPLETE event.
| Monitor | ||
dispatchProgress():void
Dispatches the MonitorEvent.PROGRESS event.
| Monitor |
Monitor | () | constructor |
public function Monitor()
Creates a new monitor.
add | () | method |
public function add(loaderItem:ILoaderItem, weight:uint = 0):void
Adds a loader item to a progress monitor.
You can add any loader item type (resource loader, sequence, sequence manager).
If no weight parameter is given, the monitor uses the items.numItems property for the weight. Adding one resource loader and a sequence of 3 items would this way result in a cumulative weight of 4. Finishing the sequence would change the monitor's progress to .75 then.
ParametersloaderItem:ILoaderItem — The loader item to be monitored.
|
|
weight:uint (default = 0 ) — The weight of the item within all monitor item's
|
clear | () | method |
public function clear():void
Removes all loader item references from the progress monitor.
dispatchMonitorComplete | () | method |
protected function dispatchMonitorComplete():void
Dispatches the MonitorEvent.COMPLETE event.
dispatchProgress | () | method |
protected function dispatchProgress():void
Dispatches the MonitorEvent.PROGRESS event.
remove | () | method |
public function remove(loaderItem:ILoaderItem):void
Removes a loader item from the progress monitor.
ParametersloaderItem:ILoaderItem — The loader to be removed.
|
toString | () | method |
public override function toString():String
Info
ReturnsString |