Package | fl.rsl |
Class | public class RSLPreloader |
Inheritance | RSLPreloader EventDispatcher Object |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
RSLEvent.RSL_LOAD_COMPLETE
,
RSLErrorEvent.RSL_LOAD_FAILED
or
RSLEvent.RSL_PROGRESS
) to indicate the status of RSL file loading.
Related API Elements
Property | Defined By | ||
---|---|---|---|
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
debugWaitTime : int
Set this value to the number of milliseconds to wait before
downloading the first RSL file. | RSLPreloader | ||
numRSLInfos : int [read-only]
The number of RSLInfo instances added via addRSLInfo(). | RSLPreloader |
Method | Defined By | ||
---|---|---|---|
RSLPreloader(mainTimeline:MovieClip = null)
Constructor. | RSLPreloader | ||
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 | ||
Adds a descriptive
RSLInfo record to the SWF or SWZ file being downloaded. | RSLPreloader | ||
Dispatches an event into the event flow. | EventDispatcher | ||
Gets the RSLInfo record added via addRSLInfo() at the specified index. | RSLPreloader | ||
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | ||
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 | ||
The loadContent method is called from frame 2 of the wrapper SWF when a content class
name is supplied to the start() method. | RSLPreloader | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Removes a listener from the EventDispatcher object. | EventDispatcher | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Starts downloading the RSL files. | RSLPreloader | ||
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 | ||
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Event | Summary | Defined By | ||
---|---|---|---|---|
[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | |||
[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher | |||
Dispatched by RSLPreloader when all RSLs have completed loading. | RSLPreloader | |||
Dispatched by RSLPreloader when all RSLs have finished downloading and one or more have failed. | RSLPreloader | |||
Dispatched by RSLPreloader to indicate progress in downloading RSL files. | RSLPreloader |
debugWaitTime | property |
debugWaitTime:int
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
Set this value to the number of milliseconds to wait before
downloading the first RSL file. This is one way to
simulate the end-user experience and test the
preload loop. It is especially useful in testing signed cache
RSLs (SWZ files), to build in a loading delay
without flushing the SWZ cache.
Disable any code that sets this value to
greater than 0 before deploying. Use a debug
config constant (such as CONFIG::DEBUG
) to call the code.
Another suggestion is to set the delay to a relatively LARGE
value, such as 5000 (equivalent to 5 seconds), as a reminder to
remove the debug code.
For RSLLoader instances that are automatically
generated by authoring, the dalay can be set by defining a
setRSLPreloader(value:RSLPreloader):void
method in the
loading animation SWF or in the main timeline code.
import fl.rsl.RSLPreloader; function setRSLPreloader(preloader:RSLPreloader):void { preloader.debugWaitTime = 10000; }
The default value is 0.
Implementation
public function get debugWaitTime():int
public function set debugWaitTime(value:int):void
numRSLInfos | property |
numRSLInfos:int
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
The number of RSLInfo instances added via addRSLInfo()
.
for(var i:int = 0; i < myPreloader.numRSLInfos; i++) { trace('rsl ' + i); var urls:Array = myPreloader.getRSLInfoAt(i).rslURLs; for(var j:int = 0; j < urls.length; j++) { trace(' url: ' + urls[j]); } }
Implementation
public function get numRSLInfos():int
Related API Elements
RSLPreloader | () | Constructor |
public function RSLPreloader(mainTimeline:MovieClip = null)
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
Constructor. When authoring outputs code automatically to preload SWZ files, it passes in the main timeline class as an argument. This is not generally useful for end-user written code.
ParametersmainTimeline:MovieClip (default = null )
|
addRSLInfo | () | method |
public function addRSLInfo(info:RSLInfo):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
Adds a descriptive RSLInfo record to the SWF or SWZ file being downloaded.
import fl.rsl.RSLInfo; var info:RSLInfo = new RSLInfo(); info.addEntry('rsl.swf'); myPreloader.addRSLInfo(info); myPreloader.start();
Parameters
info:RSLInfo |
getRSLInfoAt | () | method |
public function getRSLInfoAt(index:int):RSLInfo
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
Gets the RSLInfo record added via addRSLInfo()
at the specified index. The index
corresponds to the order in which the records were added via
addRSLInfo()
.
for (var i:int = 0; i < myPreloader.numRSLInfos; i++) { trace('rsl ' + i); var urls:Array = myPreloader.getRSLInfoAt(i).rslURLs; for (var j:int = 0; j < urls.length; j++) { trace(' url: ' + urls[j]); } }
Parameters
index:int |
RSLInfo |
Related API Elements
loadContent | () | method |
public function loadContent():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
The loadContent method is called from frame 2 of the wrapper SWF when a content class name is supplied to the start() method. It is not generally used with end-user written code.
Related API Elements
start | () | method |
public function start(preloaderAnimClass:Class = null, contentClassName:String = null):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
Starts downloading the RSL files. This function should not be called until
all RSLInfo records have been added via addRSLInfo()
.
Two optional arguments may be used when authoring outputs code automatically.
The first is a ByteArray subclass to load a preloader SWF
animation. The second is the name of a ByteArray subclass for the
content SWF, These arguments are not generally used in
end-user written code.
Parameters
preloaderAnimClass:Class (default = null )
| |
contentClassName:String (default = null )
|
Related API Elements
rslLoadComplete | Event |
fl.events.RSLEvent
property RSLEvent.type =
fl.events.RSLEvent.RSL_LOAD_COMPLETE
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
Dispatched by RSLPreloader when all RSLs have completed loading.
Event dispatched byRSLPreloader
when all RSLs have successfully
downloading. The bytesLoaded
and bytesTotal
properties
are always 0 for this event type. When preloading with a custom event loop, user
content MUST listen for this event to determine when to exit the loading animation loop.
This event has the following properties:
Property | Value |
---|---|
bubbles | true |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The DisplayObject instance being added to the display list.
The target is not always the object in the display list
that registered the event listener. Use the currentTarget
property to access the object in the display list that is currently processing the event. |
rslsLoaded | The number of files that have downloaded successfully. |
rslsFailed | the number of files that have failed to download. |
rslsTotal | the total number of files that have downloaded, successfully or not. |
bytesLoaded | The total number of downloaded bytes in files that have successfully downloaded. |
bytesTotal | the total number of downloaded bytes in files that have downloaded, successful or not. |
import fl.events.RSLEvent; myPreloader.addEventListener(RSLEvent.RSL_LOAD_COMPLETE, loadComplete); function loadComplete(e:RSLEvent) { gotoAndPlay('startOfContent'); }
rslLoadFailed | Event |
fl.events.RSLErrorEvent
property RSLErrorEvent.type =
fl.events.RSLErrorEvent.RSL_LOAD_FAILED
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
Dispatched by RSLPreloader when all RSLs have finished downloading and one or more have failed.
Error dispatched byRSLPreloader
when all RSLs have finished
downloading and one or more have failed. When preloading with a custom event loop, user
content MUST listen for this event to determine when to exit the loading animation loop.
This event has the following properties:
Property | Value |
---|---|
bubbles | true |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The DisplayObject instance being added to the display list.
The target is not always the object in the display list
that registered the event listener. Use the currentTarget
property to access the object in the display list that is currently processing the event. |
rslsLoaded | The number of files that have downloaded successfully. |
rslsFailed | the number of files that have failed to download. |
rslsTotal | the total number of files that have downloaded, successfully or not. |
failedURLs | An array of files that have failed to download. |
import fl.events.RSLErrorEvent; myPreloader.addEventListener(RSLErrorEvent.RSL_LOAD_FAILED, rslLoadFailedHandler); function rslLoadFailedHandler(e:RSLErrorEvent) { gotoAndPlay('rslLoadFailure'); }
rslProgress | Event |
fl.events.RSLEvent
property RSLEvent.type =
fl.events.RSLEvent.RSL_PROGRESS
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS5 |
Runtime Versions: | Flash Player 10.1, AIR 2 |
Dispatched by RSLPreloader to indicate progress in downloading RSL files.
Event dispatched byRSLPreloader
to indicate progress in
downloading RSL files. This is the only event type for which the
bytesLoaded
and bytesTotal
properties are non-zero.
This event has the following properties:
Property | Value |
---|---|
bubbles | true |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The DisplayObject instance being added to the display list.
The target is not always the object in the display list
that registered the event listener. Use the currentTarget
property to access the object in the display list that is currently processing the event. |
rslsLoaded | The number of files that have downloaded successfully. |
rslsFailed | the number of files that have failed to download. |
rslsTotal | the total number of files that have downloaded, successfully or not. |
bytesLoaded | The total number of downloaded bytes in files that have successfully downloaded. |
bytesTotal | the total number of downloaded bytes in files that have downloaded, successful or not. |
import fl.events.RSLEvent; myPreloader.addEventListener(RSLEvent.RSL_PROGRESS, progressHandler); function progressHandler(e:RSLEvent) { trace('rslsLoaded = ' + e.rslsLoaded); trace('rslsFailed = ' + e.rslsFailed); trace('rslsTotal = ' + e.rslsTotal); trace('bytesLoaded = ' + e.bytesLoaded); trace('bytesTotal = ' + e.bytesTotal); }
Thu Dec 6 2018, 01:12 PM -08:00