User Guide

Loading content 469
An important property of a Loader object is the contentLoaderInfo property, which is a
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
DisplayObject.loaderInfo property. LoaderInfo objects include information such as load
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(),
NetConnection.connect(), and NetStream.play() methods.
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 <img> tag, as in the
following code:
<img src = 'filename.jpg' id = 'instanceName' >
You can access content loaded this way by using the getImageReference() method of the
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
<img> tag in a text field, access to the data in the image
may be permitted by a cross-domain policy file. You can check for a policy file by adding a
checkPolicyFile attribute to the <img> tag, as in the following code:
<img src = 'filename.jpg' checkPolicyFile = 'true' id = 'instanceName' >
When you load a SWF using an <img> tag in a text field, you can permit access to that SWF
files data through a call to the
Security.allowDomain() method.