Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 469

Programming actionscript 3.0
Table of Contents

Advertisement

An important property of a Loader object is the
property, which is a
contentLoaderInfo
LoaderInfo object. Unlike most other objects, a LoaderInfo object is shared between the
loading SWF file and the loaded content, and it is always accessible to both parties. When the
loaded content is a SWF file, it can access the LoaderInfo object through the
property. LoaderInfo objects include information such as load
DisplayObject.loaderInfo
progress, the URLs of loader and loadee, the trust relationship between loader and loadee, and
other information. For more information, see
"The LoaderInfo class" on page
180.
Loading sound and videos
All SWF files, other than those in the local-with-filesystem sandbox, are allowed to load
sound and video from network origins, using the
,
Sound.load()
, and
methods.
NetConnection.connect()
NetStream.play()
Only local SWF files can load media from the local file system. Only SWF files in the local-
with-filesystem sandbox or the local-trusted sandbox can access data in these loaded files.
There are other restrictions on accessing data from loaded media. For details, see
"Accessing
loaded media as data" on page
474.
Loading SWF files and images using the <img> tag in
a text field
You can load SWF files and bitmaps into a text field by using the
tag, as in the
<img>
following code:
<img src = 'filename.jpg' id = 'instanceName' >
You can access content loaded this way by using the
method of the
getImageReference()
TextField instance, as in the following code:
var loadedObject:DisplayObject =
myTextField.getImageReference('instanceName');
Note, however, that SWF files and images loaded in this way are put in the sandbox that
corresponds to their origin.
When you load an image file using an
tag in a text field, access to the data in the image
<img>
may be permitted by a cross-domain policy file. You can check for a policy file by adding a
attribute to the
tag, as in the following code:
checkPolicyFile
<img>
<img src = 'filename.jpg' checkPolicyFile = 'true' id = 'instanceName' >
When you load a SWF using an
tag in a text field, you can permit access to that SWF
<img>
file's data through a call to the
method.
Security.allowDomain()
Loading content
469

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents