| Package | ch.capi.net.policies |
| Class | public class DefaultLoadPolicy |
| Inheritance | DefaultLoadPolicy Object |
| Implements | ILoadPolicy |
ILoadPolicy. This class manages the number of a file must
be reloaded if its download fails.
The DefaultLoadPolicy uses weak references to store the files in order to know how
many times the files have been reloaded.
| Property | Defined By | ||
|---|---|---|---|
| canContinue : Boolean [read-only]
Defines if the massive loading can continue or not when a download has failed. | DefaultLoadPolicy | ||
| continueOnFailure : Boolean
Defines if the massive loading can continue event if a file fails to be downloaded. | DefaultLoadPolicy | ||
| defaultFiles : IMap [read-only]
Defines the IMap that links the loaded files within a default file to load
if the specified file failed. | DefaultLoadPolicy | ||
| reloadTimes : uint
Defines how many times a file must be reloaded if its download fails. | DefaultLoadPolicy | ||
| Method | Defined By | ||
|---|---|---|---|
DefaultLoadPolicy(reloadTimes:uint = 1, continueOnFailure:Boolean = true)
Creates a new DefaultLoadPolicy object. | DefaultLoadPolicy | ||
getFileLoadedTimes(file:ILoadManager):uint
Retrieves how many times a file has been loaded. | DefaultLoadPolicy | ||
Called by the MassLoader when a file download is complete. | DefaultLoadPolicy | ||
Called by a IMassLoader before it starts to load the specified ILoadManager. | DefaultLoadPolicy | ||
| canContinue | property |
canContinue:Boolean [read-only]
Defines if the massive loading can continue or not when a download has failed. This property will only
be checked after the processFileClose() method has been called and
only if it returns null.
public function get canContinue():Boolean| continueOnFailure | property |
public var continueOnFailure:BooleanDefines if the massive loading can continue event if a file fails to be downloaded.
| defaultFiles | property |
defaultFiles:IMap [read-only]
Defines the IMap that links the loaded files within a default file to load
if the specified file failed. Note that this IMap uses weak references.
public function get defaultFiles():IMap
var lp:DefaultLoadPolicy = new DefaultLoadPolicy(2);
var ml:MassLoader = new MassLoader(0, true, lp);
var factory:LoadableFileFactory = new LoadableFileFactory();
var baseFile:ILoadableFile = factory.create("foo.xml");
var defaultFile:ILoadableFile = factory.create("fooDefault.xml");
lp.defaultFiles.put(baseFile, defaultFile);
ml.addFile(baseFile);
ml.start();
| reloadTimes | property |
public var reloadTimes:uintDefines how many times a file must be reloaded if its download fails. 0 means that the file will be reloaded since it is successfully loaded.
| DefaultLoadPolicy | () | Constructor |
public function DefaultLoadPolicy(reloadTimes:uint = 1, continueOnFailure:Boolean = true)
Creates a new DefaultLoadPolicy object.
reloadTimes:uint (default = 1) — Defines how many times a file must be reloaded if its download fails. 0 means that
the file will be reloaded since it is successfully loaded.
| |
continueOnFailure:Boolean (default = true) — Defines if the massive loading can continue event if a file fails to be downlaoded.
|
| getFileLoadedTimes | () | method |
public function getFileLoadedTimes(file:ILoadManager):uintRetrieves how many times a file has been loaded.
Parameters
file:ILoadManager — The ILoadManager.
|
uint — The number of times that the file has been loaded (starts from 1).
|
| processFileClose | () | method |
public function processFileClose(file:ILoadManager, closeEvent:Event, source:IMassLoader):ILoadManager
Called by the MassLoader when a file download is complete. This can be due
to a successful download or not (see the closeEvent parameters).
Parameters
file:ILoadManager — The ILoadManager to process.
| |
closeEvent:Event — The event within the ILoadManager is finished.
| |
source:IMassLoader — The IMassLoader processing the ILoadManager.
|
ILoadManager — The ILoadManager to reload or null if there is nothing do.
|
| processFileOpen | () | method |
public function processFileOpen(file:ILoadManager, source:IMassLoader):ILoadManager
Called by a IMassLoader before it starts to load the specified ILoadManager. If
this method returns null, then the IMassLoader will simply skip the file. This method
simply return the specified ILoadManager.
Parameters
file:ILoadManager — The ILoadManager before being started.
| |
source:IMassLoader — The IMassLoader processing the ILoadManager.
|
ILoadManager — The ILoadManager to load or null if the IMassLoader must skip
The file.
|
var lp:DefaultLoadPolicy = new DefaultLoadPolicy(2);
var ml:MassLoader = new MassLoader(0, true, lp);
//...
ml.start();