class AssetLoader
package feathers.controls
extends FeathersControl › MeasureSprite › ValidatingSprite
Loads and displays an asset using either OpenFL's asset management system or from a URL.
Supports assets of the following types:
Events:
openfl.events.Event.COMPLETE | Dispatched when |
---|---|
openfl.events.ProgressEvent.PROGRESS | Dispatched periodically as
|
openfl.events.IOErrorEvent.IO_ERROR | Dispatched if an IO error occurs
while loading |
openfl.events.SecurityErrorEvent.SECURITY_ERROR | Dispatched if a
security error occurs while loading |
1.0.0
.See also:
Constructor
Variables
scaleMode:StageScaleMode
Determines how the asset will be scaled within the width and height of
the AssetLoader
instance. Uses the same constants from
StageScaleMode
that are used to scale the OpenFL stage.
The following example maintains the aspect ratio of the asset, but displays no border, and may crop it to fit:
loader.scaleMode = StageScaleMode.NO_BORDER
1.0.0
.See also:
source:String
Sets the loader's source, which may be either the name of an asset or a URL to load the asset from the web instead.
The following example sets the source to an asset name:
loader.source = "my-asset-name";
The following example sets the source to a URL:
loader.source = "https://example.com/my-asset.png";
1.0.0
.