Using ASP technology in Flash

Source: Internet
Author: User
Tags html page sql variables variable urlencode access database
Database structure:
Step one: Build the database. The example uses an Access database, with a table named Tblstaff, with three fields: Strid (AutoNumber), Strknownas (text), Strsurname (text). This is a database to demonstrate the user name, just add some data.

Step two: Create a flash 4 animation:
The steps are as follows:
1 Create three text field, which is used to display the data.
2 sets the name of the first text field to input, which is used to receive input data.
3 The other two text field is named Knownas and surname respectively.
4 other settings first for default.
5 Finally, select Add a button from the Flash library (should be a reusable component Scrollbarbutton). This is a very important step, the button will pass the input variables to the ASP page to the button's properties on the Click Action page, click the + and on MouseEvent, check the release box.
6 Click "+" and Load/unload Movie again, select "Load Variables into Location", enter your ASP filename (for example, flash.asp) in the URL input box, select Target.
7 Finally, select the Send using POST in Variables and click the "+" sign to set the variable. Enter "Input" in the Variable input box (the name of the first text field) when the above work is done, you should see the following in Action box:
On (release)
Load Variables ("flash.asp", "" ", Vars=post)
Set Variable: "Input" = ""
End on
This way, when the button is clicked and released during the animation, the contents of the input box are passed to the flash.asp file. Note that the form is a post way to pass variables.
8 now create an HTML page in which to include this Flash animation file.

Step three: Code for ASP files
<% Set Connection = Server.CreateObject ("ADODB.") Connection ")
Set Recordset = Server.CreateObject ("ADODB.") Recordset ")
Connection.Open "People" ' Your database-connected 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))
%>
Note that the Knownas and Surname are passed back to the writing, will be like this: Knownas=data1&surname=data2 use Server.URLEncode (VariableName) To ensure that passing variables are encoded in the URL format.

The following is 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 do not use ASP can also pass variables to a SWF file, as long as:
< PARAM name=movie value= "Mymovie.swf?myvariable=text+of+my+variable" >

Then the text "text of my Variable" will appear in the Flash animation in the location specified, and then take advantage of Flash animation features can make a strong web page out. The simplest is to use flash to combine the database to draw a very beautiful pie chart.



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.