Parameters
- A string; the URL to which to upload variables. If the SWF file issuing this call
url:String
is running in a web browser,
- The LoadVars or XML object that receives the downloaded variables.
target:Object
[optional] - A string; the
method:String
default value is
.
POST
Returns
- A Boolean value.
Boolean
Example
For the following example, add a TextInput instance called
called
, and a Button instance called
result_ta
clicks the Login button instance in the following example, two LoadVars objects are created:
and
send_lv
result_lv
and sends the data to greeting.cfm. The result from this script loads into the
object, and the server response displays in the TextArea instance (
following ActionScript to Frame 1 of the Timeline:
var submitListener:Object = new Object();
submitListener.click = function(evt:Object) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
result_ta.text = result_lv.welcomeMessage;
} else {
result_ta.text = "Error connecting to server.";
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.name = name_ti.text;
send_lv.sendAndLoad("http://www.flash-mx.com/mm/greeting.cfm",
result_lv, "POST");
};
submit_button.addEventListener("click", submitListener);
To view a more robust example, see the login.fla file in the ActionScript samples folder.
Typical paths to the ActionScript samples folder are:
Windows: boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript
Macintosh: Macintosh HD/Applications/Macromedia Flash 8/Samples and Tutorials/
Samples/ActionScript
must be in the same domain as the SWF file.
url
GET
. The
object copies the name from the
send_lv
or
method of the HTTP protocol. The
POST
name_ti
to the Stage. When the user
submit_button
result_ta
, a TextArea instance
instance
name_ti
result_lv
). Add the
LoadVars
709
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?