Package | com.adobe.icomm.assetplacement.model |
Class | public final class PackageDefinitionLoader |
Inheritance | PackageDefinitionLoader Object |
Language Version: | ActionScript 3.0 |
Product Version: | Asset Placement Building Block 9.5 |
Runtime Versions: | AIR 1.0, Flash Player 9, Flash Player 10 |
The PackageDefinition
object loads the package definition file (package.xml) in a
non-blocking operation. The PackageDefinitionLoader uses an eventListener/eventDispatcher mechanism
to get a reference to the PackageDefinition object, in order to ensure:
- That every caller gets access to the same object (to prevent redundant loading of the package.xml file); and
- That the package is fully loaded before a caller makes use of it.
In order to get a reference to the PackageDefinition object, add an event listener for the
PackageDefinitionReadyEvent and make a call to getPackageDefinition()
. When
the PackageDefinition object is ready for use, the listener will be called. Add an event listener for the
PackageDefinitionLoadFailed event to get notification that the package definition failed to load.
Note: the PackageDefinitionReadyEvent listener should be removed once the event fires; if it is not removed the event may fire multiple times when other requesters ask for the PackageDefinition object.
Related API Elements
com.adobe.icomm.assetplacement.model.PackageDefinitionReadyEvent
com.adobe.icomm.assetplacement.model.PackageDefinitionLoadFailedEvent
Method | Defined By | ||
---|---|---|---|
Calling the constructor will result in a runtime error. | PackageDefinitionLoader | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void [static]
Add an event listener. | PackageDefinitionLoader | ||
Indicates whether an object has a specified property defined. | Object | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
[static]
Ask for the PackageDefinition object. | PackageDefinitionLoader | ||
[static]
Remove an event listener. | PackageDefinitionLoader | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Returns the primitive value of the specified object. | Object |
PackageDefinitionLoader | () | Constructor |
public function PackageDefinitionLoader()
Language Version: | ActionScript 3.0 |
Product Version: | Asset Placement Building Block 9.5 |
Runtime Versions: | AIR 1.0, Flash Player 9, Flash Player 10 |
Calling the constructor will result in a runtime error.
addEventListener | () | method |
public static function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Language Version: | ActionScript 3.0 |
Product Version: | Asset Placement Building Block 9.5 |
Runtime Versions: | AIR 1.0, Flash Player 9, Flash Player 10 |
Add an event listener.
Parameters
type:String | |
listener:Function | |
useCapture:Boolean (default = false )
| |
priority:int (default = 0 )
| |
useWeakReference:Boolean (default = false )
|
readyPackageDefinition | () | method |
public static function readyPackageDefinition(onPackageDefinitionReady:Function = null):void
Language Version: | ActionScript 3.0 |
Product Version: | Asset Placement Building Block 9.5 |
Runtime Versions: | AIR 1.0, Flash Player 9, Flash Player 10 |
Ask for the PackageDefinition object. When the object is ready, listeners will receive a PackageDefinitionReadyEvent that contains a reference to the PackageDefinition object.
Parameters
onPackageDefinitionReady:Function (default = null ) — The function to be called when the PackageDefinitionReadyEvent fires.
|
Related API Elements
removeEventListener | () | method |
public static function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Language Version: | ActionScript 3.0 |
Product Version: | Asset Placement Building Block 9.5 |
Runtime Versions: | AIR 1.0, Flash Player 9, Flash Player 10 |
Remove an event listener.
Parameters
type:String | |
listener:Function | |
useCapture:Boolean (default = false )
|
public function init():void { PackageDefinitionLoader.addEventListener(PackageDefinitionReadyEvent.PACKAGE_DEFINITION_READY, onPackageDefinitionReady); PackageDefinitionLoader.addEventListener(PackageDefinitionLoadFailedEvent.PACKAGE_DEFINITION_LOAD_FAILED, onPackageDefinitionLoadFailed); PackageDefinitionLoader.readyPackageDefinition(); } public function onPackageDefinitionReady(event:PackageDefinitionReadyEvent):void { // Once we get the ready event, we don't want to listen for it anymore PackageDefinitionLoader.removeEventListener(PackageDefinitionReadyEvent.PACKAGE_DEFINITION_READY, onPackageDefinitionReady); PackageDefinitionLoader.removeEventListener(PackageDefinitionLoadFailedEvent.PACKAGE_DEFINITION_LOAD_FAILED, onPackageDefinitionLoadFailed); var packageDef:PackageDefinition = event.packageDefinition; } public function onPackageDefinitionLoadFailed(event:PackageDefinitionLoadFailedEvent):void { PackageDefinitionLoader.removeEventListener(PackageDefinitionReadyEvent.PACKAGE_DEFINITION_READY, onPackageDefinitionReady); PackageDefinitionLoader.removeEventListener(PackageDefinitionLoadFailedEvent.PACKAGE_DEFINITION_LOAD_FAILED, onPackageDefinitionLoadFailed); var error:String = event.error; }
Wed Nov 21 2018, 06:34 AM -08:00