ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
fl.rsl 

RSLInfo  - AS3 Flash

Packagefl.rsl
Classpublic class RSLInfo
InheritanceRSLInfo Inheritance EventDispatcher Inheritance Object
Subclasses SWZInfo

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

The RSLInfo class allows to you specify the use of RSLs (Runtime Shared Library Files). A series of urls can be added (both for the SWF file and for a necessary policy file) with addEntry(). The RSLInfo class can dispatch any of these events: Event.COMPLETE, IOErrorEvent.IO_ERROR, SecurityErrorEvent.SECURITY_ERROR and ProgressEvent.PROGRESS. Because of the use of failovers, even if SecurityErrorEvents or IOErrorEvents are dispatched, the RSL download has not failed until the failed property returns true.

Related API Elements



Public Properties
 PropertyDefined By
  bytesLoaded : int
[read-only] Indicates the number of bytes that have been loaded thus far for all files being loaded.
RSLInfo
  bytesTotal : int
[read-only] Indicates the total number of bytes that have been loaded thus far for all files being loaded.
RSLInfo
  complete : Boolean
[read-only] Returns a value of true if the download has completed successfully and false if the download is not yet complete or has failed.
RSLInfo
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  currentAttemptIndex : int
[read-only] Returns the index of the URL currently attempting to download.
RSLInfo
  failed : Boolean
[read-only] Returns a value of true if the download has failed and false if the download is not yet complete or has completed successfully.
RSLInfo
  loader : Loader
[read-only] Returns the loader used to download the RSL.
RSLInfo
  policyFileURLs : Array
[read-only] Returns an array of policy file URLs that have been added via addEntry().
RSLInfo
  rslURLs : Array
[read-only] Returns an array of RSL URLs added via addEntry().
RSLInfo
Public Methods
 MethodDefined By
  
Constructor.
RSLInfo
  
addEntry(url:String, policyFileURL:String = null):void
Adds a series of URLs (RSL files and policy files).
RSLInfo
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
Starts the RSL download.
RSLInfo
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
Property Detail

bytesLoaded

property
bytesLoaded:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Indicates the number of bytes that have been loaded thus far for all files being loaded. Because some loads may fail and go to failover URLs, the bytesLoaded value can increase or decrease over time. Progress bars must compensate for this to avoid moving backward.



Implementation
    public function get bytesLoaded():int

bytesTotal

property 
bytesTotal:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Indicates the total number of bytes that have been loaded thus far for all files being loaded. Because some loads may fail and go to failover URLs, the bytesTotal value can increase or decrease over time. Progress bars must compensate for this to avoid moving backward.



Implementation
    public function get bytesTotal():int

complete

property 
complete:Boolean  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Returns a value of true if the download has completed successfully and false if the download is not yet complete or has failed.



Implementation
    public function get complete():Boolean

currentAttemptIndex

property 
currentAttemptIndex:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Returns the index of the URL currently attempting to download. When failure events are received, this index points to the URL that failed. The index belongs to the rslURLs and policyFileURLs arrays. Before downloading has begun, the index value is -1, After downloading has completed, it is equal to the length of the arrays, so range checking is recommended before using this value to access a URL array member.

         import fl.rsl.RSLInfo;
         var info:RSLInfo = new RSLInfo();
         info.addEventListener(IOErrorEvent.IO_ERROR, handleErr);
         function handleErr(e:Event) {
         trace('error: ' + e);
         trace('on download of url: ' + info.rslURLs[info.currentAttemptIndex]);
         }
         


Implementation
    public function get currentAttemptIndex():int

failed

property 
failed:Boolean  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Returns a value of true if the download has failed and false if the download is not yet complete or has completed successfully. The failed property is not set to true if a single url has failed and there are additional failover URLs to attempt.



Implementation
    public function get failed():Boolean

loader

property 
loader:Loader  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Returns the loader used to download the RSL. Can be NULL. The loader instance is created after load() has been called.



Implementation
    public function get loader():Loader

policyFileURLs

property 
policyFileURLs:Array  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Returns an array of policy file URLs that have been added via addEntry(). Treat this array as read-only. Add entries by calling addEntry(). Editing this array directly will cause unpredictable results.

         import fl.rsl.RSLInfo;
         var info:RSLInfo = new RSLInfo();
         for (var i:int = 0; i < info.policyFileURLs.length; i++) {
            trace('url: ' + info.policyFileURLs[i]);
         }
         


Implementation
    public function get policyFileURLs():Array

Related API Elements

rslURLs

property 
rslURLs:Array  [read-only]

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Returns an array of RSL URLs added via addEntry(). Treat this array as read-only. Add entries by calling addEntry(). Editing this array directly will cause unpredictable results.

         import fl.rsl.RSLInfo;
         var info:RSLInfo = new RSLInfo();
         for (var i:int = 0; i < info.rslURLs.length; i++) {
            trace('url: ' + info.rslURLs[i]);
         }
         


Implementation
    public function get rslURLs():Array

Related API Elements

Constructor Detail

RSLInfo

()Constructor
public function RSLInfo()

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Constructor.

Method Detail

addEntry

()method
public function addEntry(url:String, policyFileURL:String = null):void

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Adds a series of URLs (RSL files and policy files). The order in which the URLs are added depends on their download priority. The first URL is tried first, the second will not be tried until the first has failed, and so on. Policy files are added only when the matching RSL file URL is downloaded.

         import fl.rsl.RSLInfo;
         var info:RSLInfo = new RSLInfo();
         info.addEntry('rsl.swf');
         myPreloader.addRSLInfo(info);
         myPreloader.start();
         

Parameters

url:String
 
policyFileURL:String (default = null)

load

()method 
public function load():void

Language Version: ActionScript 3.0
Product Version: Flash CS5
Runtime Versions: Flash Player 10.1, AIR 2

Starts the RSL download. The first entry added is tried first. Subsequent entries are tried as backups as failures occur.