First, the use of loadvariables
An example simply describes how to send a request to a server-side ASP via a Get method:
Copy Code code as follows:
_root. Pushaction = function (URL,) {
This.loadvariables (URL, "get");
}
var ask = true;
var pushurl = "http://localhost/test/return.asp?ask=" + ask;
Pushaction (Pushurl);
_root.onenterframe = Fuction () {
Trace (_root.output);
}
Here we first define a function called Pushaction, which uses the get parameter in the Loadvariables function. A Boolean variable called ask is then defined to pass the variable to the server. Finally, the Pushaction function is used to send a GET request to an ASP page named Return on the server. If you need to handle such a request, in ASP, the parse result for the URL row exists in the request object, such as the following example:
Return.asp
[Copy to Clipboard] [ - ] CODE:
<%@ language= "JScript"%>
<%
Declaring and defining variables that accept requests
var str_getask= request.querystring ("ask");
Declaring and defining return information variables
var str_msg = "sorry! Your request tread awry. ";
If the accepted variable is true, a success message is returned
if (Str_getask = = "true") {
str_msg = "ok! Your request Succeed! ";
}
Response.Write ("output=" + str_msg);
%>
Thus, a variable whose name is output and the value is Str_msg is sent back to Flash Player, which can be referenced in Flash by the name of output. Of course we have to be aware that the server takes time to handle this process, so the last Onenterframe is used to test whether any variables are returned.
Current 1/3 page
123 Next read the full text