Package | com.dougmccune.baseClasses |
Class | public class SWFLoader |
Inheritance | SWFLoader ![]() |
Subclasses | AnimatedGifLoader |
See also
Property | Defined by | ||
---|---|---|---|
autoLoad : Boolean
A flag that indictes whether content starts loading automatically
or waits for a clal to the
load() method. | SWFLoader | ||
bytesLoaded : Number [read-only]
The number of bytes of the SWF or image file already loaded.
| SWFLoader | ||
bytesTotal : Number [read-only]
The total size of the SWF or image file.
| SWFLoader | ||
content : DisplayObject [read-only]
This property contains the object that represents
the content that was loaded in the SWFLoader control.
| SWFLoader | ||
contentHeight : Number [read-only]
Height of the scaled content loaded by the control, in pixels.
| SWFLoader | ||
contentWidth : Number [read-only]
Width of the scaled content loaded by the control, in pixels.
| SWFLoader | ||
loaderContext : LoaderContext
A LoaderContext object to use to control loading of the content.
| SWFLoader | ||
maintainAspectRatio : Boolean
A flag that indicates whether to maintain the aspect ratio
of the loaded content.
| SWFLoader | ||
percentLoaded : Number [read-only]
The percentage of the image or SWF file already loaded.
| SWFLoader | ||
scaleContent : Boolean
A flag that indicates whether to scale the content to fit the
size of the control or resize the control to the content's size.
| SWFLoader | ||
showBusyCursor : Boolean
A flag that indicates whether to show a busy cursor while
the content loads.
| SWFLoader | ||
source : Object
The URL, object, class or string name of a class to
load as the content.
| SWFLoader | ||
trustContent : Boolean
If
true , the content is loaded
into your security domain. | SWFLoader |
Method | Defined by | ||
---|---|---|---|
Constructor.
| SWFLoader | ||
load(url:Object = null):void
Loads an image or SWF file.
| SWFLoader |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched when content loading is complete. | SWFLoader | |||
Dispatched when a network request is made over HTTP and Flash Player can detect the HTTP status code. | SWFLoader | |||
Dispatched when the properties and methods of a loaded SWF file are accessible. | SWFLoader | |||
Dispatched when an input/output error occurs. | SWFLoader | |||
Dispatched when a network operation starts. | SWFLoader | |||
Dispatched when content is loading. | SWFLoader | |||
Dispatched when a security error occurs while content is loading. | SWFLoader | |||
Dispatched when a loaded object is removed, or when a second load is performed by the same SWFLoader control and the original content is removed prior to the new load beginning. | SWFLoader |
Effect | Description | Defined by | ||
---|---|---|---|---|
completeEffect
| Triggering event: complete
An effect that is started when the complete event is dispatched. | SWFLoader |
autoLoad | property |
autoLoad:Boolean
[read-write]
A flag that indictes whether content starts loading automatically
or waits for a clal to the load()
method.
If true
, the content loads automatically.
If false
, you must call the load()
method.
The default value is true
.
This property can be used as the source for data binding.
Implementation public function get autoLoad():Boolean
public function set autoLoad(value:Boolean):void
bytesLoaded | property |
bytesLoaded:Number
[read-only]The number of bytes of the SWF or image file already loaded.
This property can be used as the source for data binding.
Implementation public function get bytesLoaded():Number
bytesTotal | property |
bytesTotal:Number
[read-only]The total size of the SWF or image file.
This property can be used as the source for data binding.
Implementation public function get bytesTotal():Number
content | property |
content:DisplayObject
[read-only]This property contains the object that represents the content that was loaded in the SWFLoader control.
Implementation public function get content():DisplayObject
contentHeight | property |
contentHeight:Number
[read-only]
Height of the scaled content loaded by the control, in pixels.
Note that this is not the height of the control itself, but of the
loaded content. Use the height
property of the control
to obtain its height.
The value of this property is not final when the complete
event is triggered.
You can get the value after the updateComplete
event is triggered.
The default value is NaN
.
public function get contentHeight():Number
contentWidth | property |
contentWidth:Number
[read-only]
Width of the scaled content loaded by the control, in pixels.
Note that this is not the width of the control itself, but of the
loaded content. Use the width
property of the control
to obtain its width.
The value of this property is not final when the complete
event is triggered.
You can get the value after the updateComplete
event is triggered.
The default value is NaN
.
public function get contentWidth():Number
loaderContext | property |
loaderContext:LoaderContext
[read-write]
A LoaderContext object to use to control loading of the content.
This is an advanced property.
Most of the time you can use the trustContent
property.
The default value is null
, which causes the control
to use the trustContent
property to create
a LoaderContext object, which you can read back
after the load starts.
To use a custom LoaderContext object, you must understand the
SecurityDomain and ApplicationDomain classes.
Setting this property will not start a load;
you must set this before the load starts.
This does not mean that you have to set autoLoad
property
to false
, because the load does not actually start
immediately, but waiting for the creationComplete
event
to set it is too late.
The default value is null
.
This property can be used as the source for data binding.
Implementation public function get loaderContext():LoaderContext
public function set loaderContext(value:LoaderContext):void
See also
maintainAspectRatio | property |
maintainAspectRatio:Boolean
[read-write]
A flag that indicates whether to maintain the aspect ratio
of the loaded content.
If true
, specifies to display the image with the same ratio of
height to width as the original image.
The default value is true
.
This property can be used as the source for data binding.
Implementation public function get maintainAspectRatio():Boolean
public function set maintainAspectRatio(value:Boolean):void
percentLoaded | property |
percentLoaded:Number
[read-only]The percentage of the image or SWF file already loaded.
The default value is 0
.
This property can be used as the source for data binding.
Implementation public function get percentLoaded():Number
scaleContent | property |
scaleContent:Boolean
[read-write]
A flag that indicates whether to scale the content to fit the
size of the control or resize the control to the content's size.
If true
, the content scales to fit the SWFLoader control.
If false
, the SWFLoader scales to fit the content.
The default value is true
.
This property can be used as the source for data binding.
Implementation public function get scaleContent():Boolean
public function set scaleContent(value:Boolean):void
showBusyCursor | property |
showBusyCursor:Boolean
[read-write]
A flag that indicates whether to show a busy cursor while
the content loads.
If true
, shows a busy cursor while the content loads.
The default busy cursor is the mx.skins.halo.BusyCursor
as defined by the busyCursor
property of the CursorManager class.
The default value is false
.
public function get showBusyCursor():Boolean
public function set showBusyCursor(value:Boolean):void
See also
source | property |
source:Object
[read-write]
The URL, object, class or string name of a class to
load as the content.
The source
property takes the following form:
source="URLOrPathOrClass"
source="@Embed(source='PathOrClass')"
The value of the source
property represents
a relative or absolute URL,
an object that implements IFlexDisplayObject,
a class whose type implements IFlexDisplayObject,
or a String that represents a class.
When you specify a path to a SWF, GIF, JPEG, PNG, or SVG file, Flex automatically converts the file to the correct data type for use with the SWFLoader control.
If you omit the Embed statement, Flex loads the referenced file at runtime;
it is not packaged as part of the generated SWF file.
At runtime, the source
property only supports the loading of
GIF, JPEG, PNG images, and SWF files.
Flex Data Services users can use the SWFLoader control to load a Flex application by using the following form:
source="MXMLPath.mxml.swf"
Flex Data Services compiles the MXML file, and returns the SWF file to the main application. This technique works well with SWF files that add graphics or animations to an application, but are not intended to have a large amount of user interaction. If you import SWF files that require a large amount of user interaction, you should build them as custom components.
The default value is null
.
This property can be used as the source for data binding.
Implementation public function get source():Object
public function set source(value:Object):void
trustContent | property |
trustContent:Boolean
[read-write]
If true
, the content is loaded
into your security domain.
This means that the load fails if the content is in another domain
and that domain does not have a crossdomain.xml file allowing your
domain to access it.
This property only has an affect on the next load,
it will not start a new load on already loaded content.
The default value is false
, which means load
any content without failing, but you cannot access the content.
Most importantly, the loaded content cannot
access your objects and code, which is the safest scenario.
Do not set this property to true
unless you are absolutely sure of the safety
of the loaded content, especially active content like SWF files.
You can also use the loaderContext
property
to exactly determine how content gets loaded,
if setting trustContent
does not exactly
meet your needs.
The loaderContext
property causes the SWFLoader
to ignore the value of the trustContent
property.
But, you should be familiar with the SecurityDomain
and ApplicationDomain classes to use the loaderContext
property.
The default value is false
.
This property can be used as the source for data binding.
Implementation public function get trustContent():Boolean
public function set trustContent(value:Boolean):void
See also
SWFLoader | () | constructor |
public function SWFLoader()
Constructor.
load | () | method |
public function load(url:Object = null):void
Loads an image or SWF file.
The url
argument can reference a GIF, JPEG, PNG,
or SWF file; you cannot use this method to load an SVG file.
Instead, you must load it using an Embed statement
with the source
property.
url:Object (default = null ) — Absolute or relative URL of the GIF, JPEG, PNG,
or SWF file to load.
|
complete | event |
flash.events.Event
Dispatched when content loading is complete.
This event is dispatched regardless of whether the load was triggered
by an autoload or an explicit call to the load()
method.
httpStatus | event |
flash.events.HTTPStatusEvent
Dispatched when a network request is made over HTTP and Flash Player can detect the HTTP status code.
init | event |
flash.events.Event
Dispatched when the properties and methods of a loaded SWF file are accessible. The following two conditions must exist for this event to be dispatched:
ioError | event |
flash.events.IOErrorEvent
Dispatched when an input/output error occurs.
See also
open | event |
progress | event |
flash.events.ProgressEvent
Dispatched when content is loading.
This event is dispatched regardless of whether the load was triggered
by an autoload or an explicit call to the load()
method.
Note:
The progress
event is not guaranteed to be dispatched.
The complete
event may be received, without any
progress
events being dispatched.
This can happen when the loaded content is a local file.
securityError | event |
flash.events.SecurityErrorEvent
Dispatched when a security error occurs while content is loading. For more information, see the Flash Player SecurityErrorEvent class.
unload | event |
flash.events.Event
Dispatched when a loaded object is removed, or when a second load is performed by the same SWFLoader control and the original content is removed prior to the new load beginning.