User Guide

280 Chapter 11: Working with External Data
This ActionScript creates a new LoadVars object instance, copies the values from the text fields
into the instance, and then sends the data to the server. The CFM file sends the e-mail and
returns a variable (
true or false) to the SWF file called result, which appears in the
debug_txt text field.
Note: Remember to change the URL www.yoursite.com to your own domain.
9.
Save the document as sendEmail.fla, and then publish it by selecting File > Publish.
10.
Upload sendEmail.swf to the same directory that contains email.cfm (the ColdFusion file you
saved and uploaded in step 2).
11.
View and test the SWF file in a browser.
For more information, see the “LoadVars class” entry in Flash ActionScript Language Reference.
About XML
Extensible Markup Language (XML) is becoming the standard for exchanging structured data in
Internet applications. You can integrate data in Flash with servers that use XML technology to
build sophisticated applications, such as chat or brokerage systems.
In XML, as with HTML, you use tags to specify, or mark up, a body of text. In HTML, you use
predefined tags to indicate how text should appear in a web browser (for example, the
<b> tag
indicates that text should be bold). In XML, you define tags that identify the type of a piece of
data (for example,
<password>VerySecret</password>). XML separates the structure of the
information from the way it appears, so the same XML document can be used and reused in
different environments.
Every XML tag is called a node, or an element. Each node has a type (1, which indicates an XML
element, or 3, which indicates a text node), and elements might also have attributes. A node
nested in a node is called a child node. This hierarchical tree structure of nodes is called the XML
DOM—much like the JavaScript DOM, which is the structure of elements in a web browser.
In the following example,
<portfolio> is the parent node; it has no attributes and contains the
child node
<holding>, which has the attributes symbol, qty, price, and value:
<portfolio>
<holding symbol="rich"
qty="75"
price="245.50"
value="18412.50" />
</portfolio>
For more information on XML, see www.w3.org/XML.
Using the XML class
The methods of the ActionScript XML class (for example,
appendChild(), removeNode(), and
insertBefore()) let you structure XML data in Flash to send to a server and manipulate and
interpret downloaded XML data.