Packagecom.adobe.portfolio.managers
Classpublic class ResourceManager
InheritanceResourceManager Inheritance flash.events.EventDispatcher

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The ResourceManager is a singleton class that facilitates the use of resource data associated with the navigator. The resourceManager handles adding, loading, deleting, and modification of resource data.



Public Properties
 PropertyDefined By
  imageFilter : FileFilter
[read-only] Returns the filter for image files, if there is one.
ResourceManager
  instance : ResourceManager
[static] [read-only] A ResourceManager static instance that can be shared by Flex components.
ResourceManager
  loadingCount : uint
[read-only] Returns a count of the number of resource loads that are currently in the process of being loaded.
ResourceManager
  purgeOnNeedsSave : Boolean = false
A Boolean indicating whether or not resources should be auto-purged on a needsSave event.
ResourceManager
  swfFilter : FileFilter
[read-only] Returns the filter for SWF files, if there is one.
ResourceManager
Public Methods
 MethodDefined By
  
ResourceManager(target:IEventDispatcher = null)
Constructor
ResourceManager
  
addResource(browseDialogTitle:String, browseDialogFilters:Array, relativeURL:String, response:Function = null):void
Adds custom resources needed by the navigators.
ResourceManager
  
Decrements the resource loadingCount by 1.
ResourceManager
  
deleteResource(relativeURL:String, response:Function = null):void
Deletes the resource specified by relativeURL.
ResourceManager
  
dereferenceResource(relativeURL:String, tryToDelete:Boolean = false):void
Decrements by one the reference count for the specified relativeURL.
ResourceManager
  
getResource(relativeURL:String, binaryFormat:Boolean, completeListener:Function = null, ioErrorListener:Function = null, securityErrorListener:Function = null):NavURLLoader
Returns a NavURLLoader suitable for loading the given resource URL, and providing a binding to its resulting data.
ResourceManager
  
Increments the resource loadingCount by 1.
ResourceManager
  
purgeResources(purgeUnreferenced:Boolean = false):void
Deletes resources from the collectiont that have been referenced,but whose refcounts have gone to zero.
ResourceManager
  
referenceResource(relativeURL:String):void
Increments by one the reference count for the specified relativeURL
ResourceManager
  
showMissingResourcePopup(entry:String, parent:DisplayObject):Boolean
Displays an alert as a popup with the given parent indicating the the given resource entry cannot be found.
ResourceManager
  
touchResource(relativeURL:String):void
Set the reference count (initially to 0) for the relativeURL passed, if the reference count has not already been set.
ResourceManager
  
writeResource(buffer:ByteArray, relativeURL:String, response:Function = null):void
Writes the contents of the specified buffer to the location indicated by the relativeURL.
ResourceManager
Protected Constants
 ConstantDefined By
  collectionManager : CollectionManager
The navigator's CollectionManager instance.
ResourceManager
Property Detail
imageFilterproperty
imageFilter:FileFilter  [read-only]

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Returns the filter for image files, if there is one.


Implementation
    public function get imageFilter():FileFilter
instanceproperty 
instance:ResourceManager  [read-only]

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

A ResourceManager static instance that can be shared by Flex components.


Implementation
    public static function get instance():ResourceManager
loadingCountproperty 
loadingCount:uint  [read-only]

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Returns a count of the number of resource loads that are currently in the process of being loaded.

This property can be used as the source for data binding.


Implementation
    public function get loadingCount():uint
purgeOnNeedsSaveproperty 
public var purgeOnNeedsSave:Boolean = false

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

A Boolean indicating whether or not resources should be auto-purged on a needsSave event.

swfFilterproperty 
swfFilter:FileFilter  [read-only]

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Returns the filter for SWF files, if there is one.


Implementation
    public function get swfFilter():FileFilter
Constructor Detail
ResourceManager()Constructor
public function ResourceManager(target:IEventDispatcher = null)

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Constructor

Parameters
target:IEventDispatcher (default = null)
Method Detail
addResource()method
public function addResource(browseDialogTitle:String, browseDialogFilters:Array, relativeURL:String, response:Function = null):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Adds custom resources needed by the navigators. It brings up a file browsing dialog prompting the user to select the needed file. Types that are not blacklisted will be added to the resources.

This operation is only allowed when the permission "Document"/"Modify" has been granted.

It accepts an optional callback function as an argument. When a callback function is given, it is invoked to indicate the result of the operation. The callback function receives a single argument, an Object, and has the following format:

    function callback(response:Object):void
The response parameter contains properties that describe the response. These include:

PropertyTypeValue
'success'Booleantrue if the operation succeeded; false otherwise
'relativeURL'StringThe path that identifes the resource. This is the full relative path to the resource, and may differ from originalURL if the caller passes an incomplete path, which is then completed by addResource(). Use this url to later read the resource.
'originalURL'StringThe path under which this resource was requested. It will match relativeURL except in the case where addResource() has completed an incomplete URL.
'error'StringA non-human-readable String describing the error. It is non-null only if success is false.

Parameters

browseDialogTitle:String — The title of the File browse dialog. This is prefixed by a string to indicate to the user that this is coming from the navigator.
 
browseDialogFilters:Array — An Array of FileFilter objects and will be used in the File browse dialog.
 
relativeURL:String — The path where the resource will be added. Must begin with "navigator/". It must be a relative path, "/" separated, but with no leading "/". If the URL does not have a file extension (that is, it does not contain a '.'), then the file extension of the added file (if any) will be appended. If the URL ends with "/", then the entire file name of the selected file will be appended.
 
response:Function (default = null) — An optional notification function, as described above.


Throws
Error — An Error is thrown if the permission "Document"/"Modify" has not been granted.

See also

decrementLoadingCount()method 
public function decrementLoadingCount():void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Decrements the resource loadingCount by 1.

deleteResource()method 
public function deleteResource(relativeURL:String, response:Function = null):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Deletes the resource specified by relativeURL. This operation is only allowed when the permission "Document"/"Modify" has been granted.

Accepts an optional callback function as an argument. When the callback function is non-null, it is invoked to indicate the result of the operation. The callback function receives a single argument, an Object, and has the following form:

    function callback(response:Object):void

The response parameter contains properties that describe the response. These include:

PropertyTypeValue
'success'Booleantrue if the deletion succeeded, falseotherwise
'error'StringA String describing the error. It is null if success is true
'relativeURL'StringThe value of the relativeURL> parameter in the function call.

Parameters

relativeURL:String
 
response:Function (default = null)

dereferenceResource()method 
public function dereferenceResource(relativeURL:String, tryToDelete:Boolean = false):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Decrements by one the reference count for the specified relativeURL. If the tryToDelete flag is set to true and the reference count, after being decremented, is 0, the resource is also deleted.

Parameters

relativeURL:String
 
tryToDelete:Boolean (default = false)

getResource()method 
public function getResource(relativeURL:String, binaryFormat:Boolean, completeListener:Function = null, ioErrorListener:Function = null, securityErrorListener:Function = null):NavURLLoader

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Returns a NavURLLoader suitable for loading the given resource URL, and providing a binding to its resulting data. The loader begins loading immediately. If event listeners are provided by the caller, then they will be invoked on the appropriate events, and should not be removed by the caller.

Parameters

relativeURL:String
 
binaryFormat:Boolean
 
completeListener:Function (default = null)
 
ioErrorListener:Function (default = null)
 
securityErrorListener:Function (default = null)

Returns
NavURLLoader
incrementLoadingCount()method 
public function incrementLoadingCount():void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Increments the resource loadingCount by 1.

purgeResources()method 
public function purgeResources(purgeUnreferenced:Boolean = false):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Deletes resources from the collectiont that have been referenced,but whose refcounts have gone to zero. If purgeUnreferenced is set to true, then resources that have not been referenced at all will also be deleted.

Parameters

purgeUnreferenced:Boolean (default = false)

referenceResource()method 
public function referenceResource(relativeURL:String):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Increments by one the reference count for the specified relativeURL

Parameters

relativeURL:String

showMissingResourcePopup()method 
public function showMissingResourcePopup(entry:String, parent:DisplayObject):Boolean

Displays an alert as a popup with the given parent indicating the the given resource entry cannot be found. Returns true if the popup is displayed; false otherwise.

Parameters

entry:String
 
parent:DisplayObject

Returns
Boolean
touchResource()method 
public function touchResource(relativeURL:String):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Set the reference count (initially to 0) for the relativeURL passed, if the reference count has not already been set. This is functionally equivalent to incrementing and decrementing the refcount. A resource with a reference count of zero is more likely to be purged by a call to purgeResources than a resource with no refcount.

Parameters

relativeURL:String

See also

writeResource()method 
public function writeResource(buffer:ByteArray, relativeURL:String, response:Function = null):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Writes the contents of the specified buffer to the location indicated by the relativeURL.

Parameters

buffer:ByteArray
 
relativeURL:String
 
response:Function (default = null)

Constant Detail
collectionManagerConstant
protected const collectionManager:CollectionManager

The navigator's CollectionManager instance. All host interaction should go through this instance, rather than the INavigatorHost directly.