Call ASP in Flash
Conditions that use ASP in Flash:
1. Your ISP's Server must support Active Server Pages and it is best to support databases.
2. You should install Flash 4
3. Need you have a preliminary understanding of ASP
OK, how to use it below:
Database structure:
The first step is to create a database. Use the Access database in the example, named TBLstaff
There are three fields: Strid, Strknownas (Text), strsurname (text).
This is a database that demonstrates usernames, just add some data.
The second step is to build a flash 4 animation Luo:
Proceed as follows:
1) Establish three Text Field. They are used to display data
2) Set the first Text Field's Name to INPUT, it is used to receive input data
3) The other two Text Field named KNOWNAS and Surname respectively
4) Other settings are default
5) Finally, choose to add a button from flash's library (it should be a reusable component scrollbarbutton).
This is a very important step, the button will pass the input variable to the ASP page to the button's properties (Properties), click the Action page. Click " " and ON MouseEvent. Strip the Release box.
6) Click " " and load / unload movie again. Select "Load Variables Into Location"
Enter your ASP file name (such as flash.asp) in the URL input box. Select Target.
7) Finally, select Send Use Post in Variables. Click " " to set the variable
Enter "INPUT" in the Variable input box (that is, the first Text Field Name)
When the above work is completed, you should see the following in the action box:
Release
Load Variables ("Flash.asp", "", VARS = POST)
SET VARIABLE: "INPUT" = ""
End on
This will pass the content in the input box to the flash.asp file when this button is clicked and released during the animation.
Note that Form is transferred in the POST mode.
8) Now establish an HTML page, which contains this Flash animation file.
Step 3: ASP file code
<%
SET Connection = Server.createObject ("AdoDb.Connection")
Set recordset = server.createObject ("adodb.recordset")
Connection.open "People" 'your database connection DSN
SQL = "Select * from tblstaff where strid =" & requirements "input") & ";"
Recordset.open SQL, Connection, 1, 2
If Recordset.eof Then
KNOWNAS = "not"
Surname = "found"
Else
KNOWNAS = Recordset ("Strknownas")
Surname = Recordset ("strsurname")
END IF
RECORDSET.CLOSE
Connection.Close
Response.write ("KNownas =" Server.urlencode (KNownas)) Response.write ("& Surname =" Server.urlencode (Surname))
%>
It is necessary to pay attention to the writing of KNOWNAS and Surname back, it will be like this.
KNOWNAS = DATA1 & SURNAME = DATA2
Using Server.urlencode (variablename) to ensure that the past variable is encoded in the URL format
Let's take a brief introduction to the principles of ASP and Flash communication:
Variables are actually passed to Flash through the URL, in fact, this is a GET method
You don't use the ASP. You can also pass the variable to a SWF file, as long as this:
The text "Text of My Variable" will then appear in the image specified in the movie of Flash.
Ok, it's said that now, now for ASP developers, just prepare the data needed by Flash, then use the animation in Flash
The function can make a strong web page. The easiest is to use Flash combined with database painting a very beautiful pie chart, huh, just, as long as you can imagine, you can make a lot of good things.