Can I pass variables to asp in flash animation?

Source: Internet
Author: User

Copy codeThe Code is as follows: Can I pass a variable to asp in flash animation?
Faq-it.org/vb /---------------------------------------------------------------

Database Structure:
The first step is to create a database. In this example, the Access database is used, and the table name is tblStaff.
There are three fields: strID (automatic number), strKnownAs (Text), strSurname (Text ).
This is a database used to demonstrate the user name. Add some data as needed.
Step 2 is to create an animation for Flash 4:
The procedure is as follows:
1) create three text fields. They are used to display data.
2) set the name of the first text field to Input, which is used to receive Input data.
3) the other two text fields are named KnownAs and Surname respectively.
4) set other settings to default first.
5) Finally, select a button (it should be a reusable component ScrollBarButton) from the Flash library ).
This is an important step. The button will pass the input variables to the ASP page.
Click the Action page On Properties of the button. Click "+" and On MouseEvent. Hook the Release box.
6) Click "+" and "Load/Unload Movie. 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 using POST in Variables. Click "+" to set the variable.
Enter "Input" in the Variable Input box (that is, the name of the first text field)
After 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 content in the Input box will be passed to the flash. asp file.
Note that form uses the post method to pass variables.
8) Create an HTML page that contains the 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 =" & 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 writing method for transferring KnownAs and Surname back will be like this.
KnownAs = Data1 & Surname = Data2
Use Server. URLEncode (VariableName) to ensure that the variables passed in the past are encoded according to the URL format.
The following describes the principles of ASP and Flash Communication:
Variables are actually transmitted to Flash through URLs. In fact, this is a GET method.
You can pass variables to a swf file without using ASP, As long:
<Param name = movie VALUE = "myMovie.swf? MyVariable = Text + of + my + variable ">
The Text "Text of my variable" will appear in the position specified in the Flash animation.
Now, for ASP developers, they only need to prepare the data required by Flash and then use the animation in Flash.
A powerful web page can be created. The simplest thing is to use flash to draw a beautiful pie chart in combination with the database.
A lot of good things come out.

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.