GroupLoad
| Kind of class: | public class |
|---|---|
| Package: | org.casalib.load |
| Inherits from: | ProcessGroup < Process < RemovableEventDispatcher < EventDispatcher |
| Version: | 12/01/08 |
| Author: | Aaron Clinger |
| Classpath: | org.casalib.load.GroupLoad |
| File last modified: | Monday, 01 December 2008, 11:16:36 |
Allows multiple loads to be grouped and treated as one larger load.
Example:
-
package { import flash.display.MovieClip; import org.casalib.load.GraphicLoad; import org.casalib.load.GroupLoad; import org.casalib.events.LoadEvent; public class MyExample extends MovieClip { protected var _groupLoad:GroupLoad; protected var _imageOne:GraphicLoad; protected var _imageTwo:GraphicLoad; protected var _imageThree:GraphicLoad; protected var _imageFour:GraphicLoad; public function MyExample() { super(); this._imageOne = new GraphicLoad("test1.jpg"); this._imageTwo = new GraphicLoad("test2.jpg"); this._imageThree = new GraphicLoad("test3.jpg"); this._imageFour = new GraphicLoad("test4.jpg"); this._imageTwo.loader.x = 10; this._imageThree.loader.x = 20; this._imageFour.loader.x = 30; this.addChild(this._imageOne.loader); this.addChild(this._imageTwo.loader); this.addChild(this._imageThree.loader); this.addChild(this._imageFour.loader); this._groupLoad = new GroupLoad(); this._groupLoad.addLoad(this._imageOne); this._groupLoad.addLoad(this._imageTwo); this._groupLoad.addLoad(this._imageThree); this._groupLoad.addLoad(this._imageFour); this._groupLoad.addEventListener(LoadEvent.PROGRESS, this._onProgress); this._groupLoad.addEventListener(LoadEvent.COMPLETE, this._onComplete); this._groupLoad.start(); } protected function _onProgress(e:LoadEvent):void { trace("Group is " + e.progress.percentage + "% loaded at " + e.Bps + "Bps."); } protected function _onComplete(e:LoadEvent):void { trace("Group has loaded."); } } }
Summary
Constructor
Class properties
Class properties inherited from ProcessGroup
Class properties inherited from Process
Instance properties
- loads : Array
- The loads that compose the group.
- preventCache : Boolean
- Specifies if a random value name/value pair should be appended to every load in GroupLoad true, or not append false; defaults to false.
- progress : Percent
- The percent that the group is loaded.
- loading : Boolean
- Determines if the group is loading true, or if it isn't currently loading false.
- loaded : Boolean
- Determines if all loads in the group are loaded true, or if the group hasn't finished loading false.
- Bps : int
- The current download speed of the group in bytes per second.
Instance properties inherited from ProcessGroup
Instance properties inherited from Process
Instance properties inherited from RemovableEventDispatcher
Instance methods
- addLoad (load:BaseLoadItem = null) : void
- Add a load to the group.
- removeLoad (load:BaseLoadItem) : void
- Removes a load item from the group.
- destroy : void
Instance methods inherited from ProcessGroup
Instance methods inherited from RemovableEventDispatcher
Constructor
GroupLoad
public function GroupLoad (
)
Creates a new GroupLoad.
Instance properties
Bps
public Bps:int
(read)
The current download speed of the group in bytes per second.
loaded
public loaded:Boolean
(read)
Determines if all loads in the group are loaded
true, or if the group hasn't finished loading false. loading
public loading:Boolean
(read)
Determines if the group is loading
true, or if it isn't currently loading false. loads
public loads:Array
(read)
The loads that compose the group.
Returns:
- Returns an Array containing all loads in the group.
preventCache
public preventCache:Boolean
(read,write)
Specifies if a random value name/value pair should be appended to every load in GroupLoad
true, or not append false; defaults to false. See also:
Instance methods
addLoad
Add a load to the group.
Parameters:
load :
Load to be added to the group. Can be any class that extends from BaseLoadItem (Including another GroupLoad) and dispatches events LoadEvent.COMPLETE, LoadEvent.PROGRESS and
IOErrorEvent.percentOfGroup:
Defines the percentage of the total group the size of the load item represents; defaults to equal increments.
removeLoad
Removes a load item from the group.
Parameters:
load:
Load to be removed from the group.