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