You don't need to create container movie clips for holding data or clutter existing movie
clips with variables specific to client/server communication.
The class interface is similar to that of the XML object, which provides some consistency
in ActionScript. It uses the methods
communication with a server. The main difference between the LoadVars and XML
classes is that the LoadVars data is a property of the LoadVars object rather than of an
XML Document Object Model (DOM) tree stored in the XML object.
The class interface is more straightforward—with methods named
—than the older loadVariables interface.
sendAndLoad
You can get additional information about the communication, using the
and
getBytesTotal
You can get progress information about the download of your data (although you can't
access the data until it is fully downloaded).
The callback interface is through ActionScript methods (
deprecated
onClipEvent
There are error notifications.
You can add custom HTTP request headers.
You must create a LoadVars object to call its methods. This object is a container to hold the
loaded data.
The following procedure shows how to use ColdFusion and the LoadVars class to send an e-
mail from a SWF file.
You must have ColdFusion installed on your web server for this example.
To load data with the LoadVars object:
1.
Create a CFM file in Macromedia Dreamweaver or in your favorite text editor. Add the
following text to the file:
<cfif StructKeyExists(Form, "emailTo")>
<cfmail to="#Form.emailTo#" from="#Form.emailFrom#"
subject="#Form.emailSubject#">#Form.emailBody#</cfmail>
&result=true
<cfelse>
&result=false
</cfif>
2.
Save the file as email.cfm, and upload it to your website.
3.
In Flash, create a new document.
640
Working with External Data
load()
methods.
(data) approach required for loadVariables.
,
, and
send()
sendAndLoad()
) instead of the obsolete,
onLoad
to initiate
,
,
load
send
getBytesLoaded
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?