Method of communication between flash and ASP/PHP/Asp.net page 1/3

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.