How to pass variables to asp in flash animation? How to create an ASP web page in the server and submit the data it has saved to that web page? Below are the operating methods introduced by the editor of the Wrong New Technology Channel. Let’s take a look! The code copy is as follows:
Can I pass variables to asp in flash animation?
faq-it.org/vb/----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Database structure:
The first step is to create a database. In the example, use the Access database, the table name is tblStaff
There are three fields: strID (auto-number), strKnownAs(Text), strSurname (Text).
This is a database used to demonstrate usernames, add some data.
The second step is to create a Flash 4 animation:
The steps are as follows:
1) Create three text fields. They are used to display data.
2) Set the name of the first text field to Input, it is used to receive input data
3) The other two text fields are named KnownAs and Surname respectively
4) Other settings are the default first
5) Finally, select the Flash library to add a button (it should be a reusable component ScrollBarButton).
This is an important step, the button will pass the input variable to the ASP page
Click the Action page on the Properties of the button. Click the "+" sign and On MouseEvent. Tick the Release box.
6) Click the "+" sign and Load/Unload Movie again. Select "Load Variables Into Location"
Enter your ASP file name (for example flash.asp) in the URL input box. Select Target.
7) Finally, select Send using POST in Variables. Click the "+" sign to set the variable
Enter "Input" in the Variable input box (that is the name of the first text field)
When all the above work is completed, you should see the following content in the action box:
On (Release)
Load Variables ("flash.asp", "", vars=POST)
Set Variable: "Input" = ""
End On
In this way, when this button is clicked and released during the animation process, the contents in the Input input box will be passed to the flash.asp file.
Note that form uses the post method to pass variables.
8) Now create an HTML page that contains the Flash animation file
Step 3: Code of ASP file
<%
Set Connection = Server.CreateObject("ADODB.Connection")
Set Recordset = Server.CreateObject("ADODB.Recordset")
Connection.Open "people" 'The DSN of your database connection
SQL = "SELECT * FROM tblStaff WHERE strID=" & Request.Form("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 should be noted that the way to pass KnownAs and Surname back will be like this
KnownAs=Data1&Surname=Data2
Use Server.URLEncode(VariableName) to ensure that the past variables are encoded in the URL format
Here is a brief introduction to the principles of ASP and Flash communication:
Variables are actually passed to Flash through URLs, which is actually a GET method
If you don't use ASP, you can actually pass variables to a swf file, just like this:
Then the text "Text of my variable" will appear at the specified position in the Flash animation
OK, I have said everything I need to say. Now for ASP developers, just prepare the data required for Flash and then use the animations in Flash
The function can create a powerful web page. The easiest thing is to use flash to combine the database to draw a very beautiful pie chart, haha. Anyway, as long as you can imagine it, you can make it.
A lot of good things come out. How do I pass variables to asp in flash animation? I believe everyone has a certain understanding. If you want to know more technical information, please continue to pay attention to the wrong new technology channel!