Package | ch.capi.net |
Class | public class DefaultLoadPolicy |
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.
var lp:DefaultLoadPolicy = new DefaultLoadPolicy(2); var ml:MassLoader = new MassLoader(0, true, lp); //... ml.start();
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 = 3, 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 |
canContinue | property |
canContinue:Boolean
[read-only]Defines if the massive loading can continue or not when a download has failed.
Implementation public function get canContinue():Boolean
continueOnFailure | property |
public var continueOnFailure:Boolean
Defines 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:uint
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.
DefaultLoadPolicy | () | constructor |
public function DefaultLoadPolicy(reloadTimes:uint = 3, continueOnFailure:Boolean = true)
Creates a new DefaultLoadPolicy
object.
reloadTimes:uint (default = 3 ) — 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):uint
Retrieves how many times a file has been loaded.
Parametersfile:ILoadManager — The ILoadManager .
|
uint — The number of times that the file has been loaded (starts from 1).
|
processFile | () | method |
public function processFile(file:ILoadManager, closeEvent:Event):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).
file:ILoadManager — The ILoadManager to process.
|
|
closeEvent:Event — The event within the ILoadManager is finished.
|
ILoadManager —
The ILoadManager to reload or null if there is nothing do.
|