Packagepotomac.bundle
Classpublic class BundleService
InheritanceBundleService Inheritance flash.events.EventDispatcher
Implements IBundleService

The BundleService is responsible for loading and managing bundles. It is also the source for all bundle metadata extensions.



Public Properties
 PropertyDefined By
  airBundlesURL : String
The remote URL where the bundles will be downloaded when running inside AIR.
BundleService
  airDisableCaching : Boolean = true
If true, bundle caching in the local storage when running in AIR will be disabled.
BundleService
  bundleDescriptors : Array
[read-only] Returns an array of BundleDescriptors for all installed bundles.
BundleService
  enablesForFlags : Array
An array of Strings determine which extensions are enabled or disabled based on the 'enablesFor' attribute in each extension.
BundleService
Public Methods
 MethodDefined By
  
Callers should not construct instances of BundleService.
BundleService
  
Returns the BundleDescriptor of the installed bundle with the given id.
BundleService
  
getExtension(id:String, point:String):Extension
Returns a single Extension with the given id for the given extension point.
BundleService
  
getExtensionPoint(pointID:String):ExtensionPoint
Returns the extension point with the given point id.
BundleService
  
Returns an array of ExtensionPoint objects including each extension point in all installed bundles.
BundleService
  
getExtensions(extensionPointID:String, className:String = null, superClasses:Boolean = false):Array
Returns an array of Extensions of the specified extension point.
BundleService
  
install(installables:Array):void
Triggers the installation of one or more bundles.
BundleService
  
isBundleLoaded(bundleID:String):Boolean
Returns true if the given bundle is loaded.
BundleService
  
loadBundle(id:String):void
Triggers the retrieval and load of the given bundle.
BundleService
Events
 Event Summary Defined By
  Dispatched when an error is encountered during bundle installation or loading.BundleService
  Dispatched when a bundle starts loading.BundleService
  Dispatched when a bundle file (either the assets.swf or the bundle.swf) is being downloaded.BundleService
  Dispatched when a bundle is loaded.BundleService
  Dispatched when a set of bundles is installed.BundleService
  Dispatched when a bundle installation is initiated.BundleService
  Dispatched when bundle preloading is initiated.BundleService
  Dispatched when one or more extensions are added or removed from the extension registry.BundleService
Property Detail
airBundlesURLproperty
airBundlesURL:String

The remote URL where the bundles will be downloaded when running inside AIR.


Implementation
    public function get airBundlesURL():String
    public function set airBundlesURL(value:String):void
airDisableCachingproperty 
public var airDisableCaching:Boolean = true

If true, bundle caching in the local storage when running in AIR will be disabled.

bundleDescriptorsproperty 
bundleDescriptors:Array  [read-only]

Returns an array of BundleDescriptors for all installed bundles.

This method should not be called while bundles are currently installing.


Implementation
    public function get bundleDescriptors():Array
enablesForFlagsproperty 
enablesForFlags:Array

An array of Strings determine which extensions are enabled or disabled based on the 'enablesFor' attribute in each extension.


Implementation
    public function get enablesForFlags():Array
    public function set enablesForFlags(value:Array):void
Constructor Detail
BundleService()Constructor
public function BundleService()

Callers should not construct instances of BundleService. It is available for injection through IBundleService.

Method Detail
getBundleDescriptor()method
public function getBundleDescriptor(bundleID:String):BundleDescriptor

Returns the BundleDescriptor of the installed bundle with the given id.

This method should not be called while bundles are currently installing.

Parameters

bundleID:String — Bundle ID of the bundle whose descriptor is requested.

Returns
BundleDescriptor — BundleDescriptor or null of no bundle is found with the given id.
getExtension()method 
public function getExtension(id:String, point:String):Extension

Returns a single Extension with the given id for the given extension point.

Parameters

id:String — extension id.
 
point:String — extension point id.

Returns
Extension — the first matching Extension or null if none exists.
getExtensionPoint()method 
public function getExtensionPoint(pointID:String):ExtensionPoint

Returns the extension point with the given point id.

Parameters

pointID:String — id/tag name of the extension point.

Returns
ExtensionPoint — the ExtensionPoint
getExtensionPoints()method 
public function getExtensionPoints():Array

Returns an array of ExtensionPoint objects including each extension point in all installed bundles.

Returns
Array — array of ExtensionPoints
getExtensions()method 
public function getExtensions(extensionPointID:String, className:String = null, superClasses:Boolean = false):Array

Returns an array of Extensions of the specified extension point. If the className parameter is passed, it will return only those extensions declared within that class.

By default, when the className parameter is specified, only extensions declared directly within the specific class are returned. Extensions declared in the base class or super classes of the specified class are not returned. When true is passed for the superClass argument, all extensions declared in the entire class hierarchy are returned. Importantly, for Potomac to be able to inspect the class hierarchy, the class specified must be available in the Flash ApplicationDomain. In other words, the class's bundle must be loaded.

Parameters

extensionPointID:String — extension point id of the extensions to return.
 
className:String (default = null) — name of the class in which the extensions are declared.
 
superClasses:Boolean (default = false) — if true, will return extensions declared in super classes.

Returns
Array — an array of Extensions.
install()method 
public function install(installables:Array):void

Triggers the installation of one or more bundles. This method is asynchronous. When the installation is complete a bundlesInstalled event will be dispatched.

This method accepts an array that may contain Strings that contain just the simple bundle ID or BundleInstallDescriptors if you need to provide more options.

Parameters

installables:Array — An array of bundle IDs as Strings or descriptors (BundleInstallDescriptors).

isBundleLoaded()method 
public function isBundleLoaded(bundleID:String):Boolean

Returns true if the given bundle is loaded.

Parameters

bundleID:String — bundle id to check if loaded.

Returns
Boolean — true if the bundle is loaded, otherwise false.
loadBundle()method 
public function loadBundle(id:String):void

Triggers the retrieval and load of the given bundle. This method is asynchronous. A bundleReady event will be dispatched when the bundle is loaded.

Parameters

id:String — id of bundle to load.

Event Detail
bundleError Event
Event Object Type: potomac.bundle.BundleEvent
BundleEvent.type property = potomac.bundle.BundleEvent.BUNDLE_ERROR

Dispatched when an error is encountered during bundle installation or loading.

The BundleEvent.BUNDLE_ERROR constant defines the value of the type property of the event object for a bundleError event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
bundleIDThe id of the bundle this error event is associated with.
isRepeatfalse
urlnull
bytesLoaded0
bytesTotal0
messageThe error message.
bundleLoading Event  
Event Object Type: potomac.bundle.BundleEvent
BundleEvent.type property = potomac.bundle.BundleEvent.BUNDLE_LOADING

Dispatched when a bundle starts loading.

The BundleEvent.BUNDLE_LOADING constant defines the value of the type property of the event object for a bundleLoading event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
bundleIDThe id of the bundle that is now loading.
isRepeatfalse
urlURL of the bundle SWF.
bytesLoaded0
bytesTotal0
messagenull
bundleProgress Event  
Event Object Type: potomac.bundle.BundleEvent
BundleEvent.type property = potomac.bundle.BundleEvent.BUNDLE_PROGRESS

Dispatched when a bundle file (either the assets.swf or the bundle.swf) is being downloaded.

The BundleEvent.BUNDLE_PROGRESS constant defines the value of the type property of the event object for a bundleProgress event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
bundleIDThe id of the bundle this progress event is associated with.
isRepeatfalse
urlURL of the asset or SWF being downloaded.
bytesLoadedThe current bytes loaded.
bytesTotalTotal bytes of downloading asset or SWF.
messagenull
bundleReady Event  
Event Object Type: potomac.bundle.BundleEvent
BundleEvent.type property = potomac.bundle.BundleEvent.BUNDLE_READY

Dispatched when a bundle is loaded. If the isRepeat property is true, this event is repeated bundle ready event and can be ignored.

The BundleEvent.BUNDLE_READY constant defines the value of the type property of the event object for a bundleReady event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
bundleIDThe id of the loaded bundle.
isRepeatTrue if this is a repeated ready event.
urlnull
bytesLoaded0
bytesTotal0
messagenull
bundlesInstalled Event  
Event Object Type: potomac.bundle.BundleEvent
BundleEvent.type property = potomac.bundle.BundleEvent.BUNDLES_INSTALLED

Dispatched when a set of bundles is installed.

The BundleEvent.BUNDLES_INSTALLED constant defines the value of the type property of the event object for a bundlesInstalled event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
bundleIDnull
isRepeatfalse
urlnull
bytesLoaded0
bytesTotal0
messagenull
bundlesInstalling Event  
Event Object Type: potomac.bundle.BundleEvent
BundleEvent.type property = potomac.bundle.BundleEvent.BUNDLES_INSTALLING

Dispatched when a bundle installation is initiated.

The BundleEvent.BUNDLES_INSTALLING constant defines the value of the type property of the event object for a bundlesInstalling event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
bundleIDnull
isRepeatfalse
urlnull
bytesLoaded0
bytesTotal0
messagenull
bundlesPreloading Event  
Event Object Type: potomac.bundle.BundleEvent
BundleEvent.type property = potomac.bundle.BundleEvent.BUNDLES_PRELOADING

Dispatched when bundle preloading is initiated.

The BundleEvent.BUNDLES_PRELOADING constant defines the value of the type property of the event object for a bundlesPreloading event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
bundleIDnull
isRepeatfalse
urlnull
bytesLoaded0
bytesTotal0
messagenull
extensionsUpdated Event  
Event Object Type: potomac.bundle.ExtensionEvent
ExtensionEvent.type property = potomac.bundle.ExtensionEvent.EXTENSIONS_UPDATED

Dispatched when one or more extensions are added or removed from the extension registry.

The ExtensionEvent.EXTENSIONS_UPDATED constant defines the value of the type property of the event object for a extensionsUpdated event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
extensionsAddedArray of Extensions added to the registry.
extensionsRemovedArray of Extensions removed from the registry.