Onload (Loadvars.onload Handler) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

onLoad (LoadVars.onLoad handler)

onLoad = function(success:Boolean) {}
Invoked when a
LoadVars.load()
operation was successful, my_lv is populated with variables downloaded by the operation, and
these variables are available when this handler is invoked.
This handler is
undefined
This event handler is similar to
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
- A Boolean value that indicates whether the load operation ended in
success:Boolean
success (
) or failure (
true
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 on 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);
or
LoadVars.sendAndLoad()
by default.
.
XML.onLoad
).
false
. The
object copies the name from the
send_lv
operation has ended. If the
, a TextArea instance
name_ti
to the Stage. When the user
submit_button
result_ta
instance
name_ti
result_lv
). Add the
LoadVars
401

Advertisement

Table of Contents
loading

Table of Contents