394 Working with Text and Strings
5. In the HTML document, modify the code inside the object tag to match the following.
The code you need to add is in boldface.
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=8,0,0,0" width="550" height="400" id="flashvars"
align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="flashvars.swf" />
<param name="FlashVars" value="username=Thomas" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="flashvars.swf" FlashVars="username=Thomas" quality="high"
bgcolor="#ffffff" width="550" height="400" name="flashvars"
align="middle" allowScriptAccess="sameDomain" type="application/x-
shockwave-flash" pluginspage="http://www.macromedia.com/go/
getflashplayer" />
</object>
6.
Save your changes to the HTML document.
7. Open the modified HTML in a web browser.
The SWF file displays the name “Thomas” in the dynamically created text field on
the Stage.
For information on security, see Chapter 17, “Understanding Security.”
Using LoadVars to load and display text
You can also use the LoadVars class to load content into a SWF file, which loads text or
variables from an external file on the same server, or even content from a different server. The
next example demonstrates how to dynamically create a text field and populate it with the
contents of a remote text file.