Loadvars.onload - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

LoadVars.onLoad

Availability
Flash Player 6.
Usage
my_lv.onLoad = function(success:Boolean) {
// your statements here
}
Parameters
A Boolean value that indicates whether the load operation ended in success (
success
failure (
).
false
Returns
A Boolean value.
Description
Event handler; invoked when a
ended. If the operation was successful,
operation, and these variables are available when this handler is invoked.
This handler is undefined by default.
This event handler is similar to
Example
For the following example, add a TextInput instance called
, and a Button instance called
result_ta
Login button instance in the following example, two LoadVars objects are created:
. The
result_lv
to greeting.cfm. The result from this script loads into the
response displays in the TextArea instance (
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);
LoadVars.load()
XML.onLoad
object copies the name from the
send_lv
or
LoadVars.sendAndLoad()
is populated with variables downloaded by the
my_lv
.
name_ti
to the Stage. When the user clicks the
submit_button
name_ti
result_lv
). Add the following ActionScript on
result_ta
true
operation has
, a TextArea instance called
send_lv
instance and sends the data
object, and the server
LoadVars.onLoad
) or
and
393

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents