Main Page | Packages | Class Tree | Index | Help

com.bjc.controls

class Loader

MovieClip
  |
  +--com.bjc.core.BJCComponent
        |
        +--com.bjc.controls.Loader


class Loader
extends BJCComponent

A loader component for loading in a jpg or movie clip from an external source. It will load the content, and fire a load event. After content is loaded, it can optionally scale the content to fit the component, or display it full size.

Events:

load - Fired when the content being loaded by the loader has completely loaded.
progress - Fired once each frame while content is being loaded into the loader.


Author:
Flashloaded - www.flashloaded.com


Field Summary

public
addEventListener: Function
See the EventDispatcher Class in Flash Help

public
loadHandler: Function
Can be used to assign a direct event handler to the component instance.

public
progressHandler: Function
Can be used to assign a direct event handler to the component instance.

public
removeEventListener: Function
See the EventDispatcher Class in Flash Help

Fields inherited from class com.bjc.core.BJCComponent

version

Property Summary

public
autoLoad: Boolean (write)
Sets the autoload mode of the component. If true, content will begin loading as soon as the url property is set. If false, you must call load to begin loading content.

public
autoLoad: Boolean (read)
Gets the autoload mode of the component.

public
autoScale: Boolean (write)
Sets the autoload mode of the component. If true, the content will scale to the size of the loader component, as set in the authoring environment, or by use of setSize, width or height. If false, content will display at full size.

public
autoScale: Boolean (read)
Gets the autoload mode of the component.

public
content: MovieClip (read-only)
Gets the content of the component.

public
progress: Number (read-only)
A value from 0 to 100, representing the amount of content that has successfully loaded in.

public
url: String (write)
Sets the url for the content (swf or jpg) to be loaded.

public
url: String (read)
Gets the url of the content (swf or jpg).

Properties inherited from class com.bjc.core.BJCComponent

disabledAlpha, enabled, focusTime, height, keyEnabled, style, width

Constructor

public
Loader ( Void)


Method Summary

public static
create ( target: MovieClip, id: String, depth: Number, initObj: Object ): Loader
Static method used to create an instance of a Loader on stage at run time.

public
load ( Void ): Void
Begins loading the content specified in the url property. If autoLoad is set to false, content will not begin loading until this method is called. If autoLoad is true, this method is not necessary, as content will begin loading immediately after setting the url.

Methods inherited from class com.bjc.core.BJCComponent

draw, invalidate, move, remove, setSize



Field Documentation

addEventListener

public var addEventListener: Function
See the EventDispatcher Class in Flash Help

loadHandler

public var loadHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myLoader.loadHandler = function(){
trace("I am done loading.");
}

progressHandler

public var progressHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myLoader.progressHandler = function(){
trace("I am loading.");
}

removeEventListener

public var removeEventListener: Function
See the EventDispatcher Class in Flash Help


Property Documentation

autoLoad

public autoLoad: Boolean (write)
Sets the autoload mode of the component. If true, content will begin loading as soon as the url property is set. If false, you must call load to begin loading content.

Example:
myLoader.autoLoad = false;
myLoader.url = "http://www.somedomain.com/somepicture.jpg";
myLoader.load();

autoLoad

public autoLoad: Boolean (read)
Gets the autoload mode of the component.

Example:
myVar = myLoader.autoLoad;

autoScale

public autoScale: Boolean (write)
Sets the autoload mode of the component. If true, the content will scale to the size of the loader component, as set in the authoring environment, or by use of setSize, width or height. If false, content will display at full size.

Example:
myLoader.autoScale = true;

autoScale

public autoScale: Boolean (read)
Gets the autoload mode of the component.

Example:
myVar = myLoader.autoScale;

content

public content: MovieClip (read-only)
Gets the content of the component.

Example:
myLoader.content.play();

progress

public progress: Number (read-only)
A value from 0 to 100, representing the amount of content that has successfully loaded in.

Example:
myProgressBar.value = myLoader.progress;

url

public url: String (write)
Sets the url for the content (swf or jpg) to be loaded.

Example:
myLoader.autoLoad = false;
myLoader.url = "http://www.somedomain.com/somepicture.jpg";
myLoader.load();

url

public url: String (read)
Gets the url of the content (swf or jpg).

Example:
myVar = myLoader.url;


Constructor Documentation

Loader

public function Loader(Void)

Method Documentation

create

public static function create(target: MovieClip,
 id: String,
 depth: Number,
 initObj: Object): Loader
Static method used to create an instance of a Loader on stage at run time.

Parameters:
target
the movie clip to which the loader will be attached.
id
the instance name given to the new loader attached.
depth
the depth at which to attach the new loader.
initObj
(optional) an object containing any properties you want to assign to the component when it is created
Returns:
a reference to the new loader attached.

Example:
import com.bjc.controls.Loader;
var newLoader:Loader = Loader.create(_root, "myLoader", 0);

load

public function load(Void): Void
Begins loading the content specified in the url property. If autoLoad is set to false, content will not begin loading until this method is called. If autoLoad is true, this method is not necessary, as content will begin loading immediately after setting the url.

Example:
myLoader.url = "http://www.somedomain.com/somepicture.jpg";
myLoader.load();


The documentation was generated from the following file:


Copyright Flashloaded - www.flashloaded.com