EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Tostring (Loadvars.tostring Method)

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
LoadVars 405
Example
For the following example, add a TextInput instance called
name_ti, a TextArea instance
called
result_ta, and a Button instance called submit_button to the Stage. When the user
clicks the Login button instance in the following example, two LoadVars objects are created:
send_lv and result_lv. The send_lv object copies the name from the name_ti instance
and sends the data to greeting.cfm. The result from this script loads into the
result_lv
object, and the server response displays in the TextArea instance (
result_ta). Add the
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
See also
send (LoadVars.send method), load (LoadVars.load method), sendAndLoad
(XML.sendAndLoad method)
toString (LoadVars.toString method)
public toString() : String
Returns a string containing all enumerable variables in my_lv, in the MIME content
encoding application/x-www-form-urlencoded.
Availability: ActionScript 1.0; Flash Lite 2.0

Table of Contents

Related product manuals