Experiment of communication between Flash and ASP

Source: Internet
Author: User
Tags urlencode

Objective: Analog login, visitors from flash input user name and password, after the ASP page verification, and then return whether the correct logo.
Objective: To see how flash and ASP transfer variables.
Reference: So long as the ASP, you can replace the validation of the database operation.
First, the contents of the ASP page test.asp are as follows:

<%
Username=request.form ("UID") ' Gets the variable submitted from flash
Password=request.form ("pwd") ' Ibid.
' Judge the user name and password correctly
If username= "Flash8" and password= "123456" Then
' Transfer variable flashlog to flash
Response.Write ("flashlog=" +server.urlencode ("yes"))
Else
Response.Write ("flashlog=" +server.urlencode ("no"))
End If
%>

Then the Flash file section:
1. Set up three layers at home scene, called as, MC, label
2. The 1th key frame signature of the label layer is "login", the 3rd sign is "OK", and the label of the 4th Keyframe is "err".
3.MC layer 1th keyframe put 2 input boxes, a variable called UID (username), a variable named pwd (password), there is a OK button, the button as as:

On (release) {
Loadvariables ("test.asp", "", "POST");
}

The 3rd Keyframe has a word: "You have successfully logged in!" "
The 4th keyframe has a text: "The username or password you entered is wrong, please go back and re-enter it." "
3rd, 4 keyframes have a return button, as the button as:

On (release) {
Flashlog= "";
gotoAndPlay ("login");
}

4. The last is the as layer, as is:
Second frame:

Get the variable from the test.asp flashlog.
Nowflag = Flashlog;
if (Nowflag = = "Yes") {
gotoAndStop ("OK");
else if (Nowflag = "No") {
gotoAndStop ("err");
} else {
gotoAndPlay ("login");
}

Frame third to fourth:

Stop ();

At this point, the production is complete, the release, the HTML, SWF and test.asp files on the support of the ASP space (or the use of native Pws/iis) to test.

Click here to download the source file

Related Article

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.