Packagecom.dougmccune.baseClasses
Classpublic class SWFLoader
InheritanceSWFLoader Inheritance mx.core.UIComponent
SubclassesAnimatedGifLoader

This is the exact same component as the SWFLoader included in the Flex framework.

See also

http://livedocs.adobe.com/flex/2/langref/mx/controls/SWFLoader.html


Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined by
  
Constructor.
SWFLoader
  
load(url:Object = null):void
Loads an image or SWF file.
SWFLoader
Events
 EventSummaryDefined 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
Styles
 StyleDescriptionDefined by
  
brokenImageBorderSkin
Type: Class   CSS Inheritance: no
The name of class to use as the SWFLoader border skin if the control cannot load the content. The default value is BrokenImageBorderSkin.
SWFLoader
  
brokenImageSkin
Type: Class   CSS Inheritance: no
The name of the class to use as the SWFLoader skin if the control cannot load the content. The default value is BrokenImageSkin.
SWFLoader
  
horizontalAlign
Type: String   CSS Inheritance: no
The horizontal alignment of the content when it does not have a one-to-one aspect ratio. Possible values are "left", "center", and "right". The default value is "left".
SWFLoader
  
verticalAlign
Type: String   CSS Inheritance: no
The vertical alignment of the content when it does not have a one-to-one aspect ratio. Possible values are "top", "middle", and "bottom". The default value is "top".
SWFLoader
Effects
 EffectDescriptionDefined by
  
completeEffect
Triggering event: complete
An effect that is started when the complete event is dispatched.
SWFLoader
Property detail
autoLoadproperty
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
bytesLoadedproperty 
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
bytesTotalproperty 
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
contentproperty 
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
contentHeightproperty 
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.

Implementation
    public function get contentHeight():Number
contentWidthproperty 
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.

Implementation
    public function get contentWidth():Number
loaderContextproperty 
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

flash.system.LoaderContext
flash.system.ApplicationDomain
flash.system.SecurityDomain
maintainAspectRatioproperty 
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
percentLoadedproperty 
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
scaleContentproperty 
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
showBusyCursorproperty 
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.

Implementation
    public function get showBusyCursor():Boolean
    public function set showBusyCursor(value:Boolean):void

See also

mx.managers.CursorManager
sourceproperty 
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
trustContentproperty 
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

flash.system.SecurityDomain
flash.system.ApplicationDomain
Constructor detail
SWFLoader()constructor
public function SWFLoader()

Constructor.

Method detail
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.

Parameters
url:Object (default = null) — Absolute or relative URL of the GIF, JPEG, PNG, or SWF file to load.
Event detail
completeevent 
Event object type: 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.

httpStatusevent  
Event object type: flash.events.HTTPStatusEvent

Dispatched when a network request is made over HTTP and Flash Player can detect the HTTP status code.

initevent  
Event object type: 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:

ioErrorevent  
Event object type: flash.events.IOErrorEvent

Dispatched when an input/output error occurs.

See also

flash.events.IOErrorEvent
openevent  
Event object type: flash.events.Event

Dispatched when a network operation starts.

progressevent  
Event object type: 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.

securityErrorevent  
Event object type: flash.events.SecurityErrorEvent

Dispatched when a security error occurs while content is loading. For more information, see the Flash Player SecurityErrorEvent class.

unloadevent  
Event object type: 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.