I. Use loadvariables
An example briefly describes how to send a request to ASP on the server through the get method:
CopyCode The Code is 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 named pushaction and use the get parameter in the loadvariables function. Then a Boolean variable named ask is defined to pass the variable to the server. Finally, use the pushaction function to send a GET request to an ASP page named return on the server. If you need to process such a request, in ASP, the analysis result of the URL row is stored in the request object, for example, in the following example:
Return. asp
[Copy to clipboard] [-] Code:
<% @ Language = "jscript" %>
<%
// Declare and define the variable for receiving the request
VaR str_getask = request. querystring ("Ask ");
// Declare and define returned 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 );
%>
In this way, a variable named output with the str_msg value is sent back to flash player. You can reference this variable with the output name in flash. Of course, we must note that the server takes time to process this process. Therefore, the last onenterframe is used to test whether a variable is returned.