Using ASP technology in Flash

Source: Internet
Author: User
Tags end html page sql variables variable urlencode access database

Use the conditions required by ASP in Flash:

1. Your ISP's server must support active Server pages and it is best to support the database

2. You should install Flash MX

3. You need to have a preliminary understanding of the ASP OK, the following specific description of how to use:

  The first step is to create a database:

Database structure:

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.


  The second step is to create a Flash animation:


The steps are as follows:


1 Create three text field. They are used to display data;


2) Set the name of the first text field to input, which is used to receive input data;

The other two text field is named Knownas and surname respectively;


4 Other settings first for the default;


5 Finally, select Add a button from the Flash library (should be a reusable component Scrollbarbutton). This is an important step and the button will pass the input variables to the ASP page and click the Action page on the button's property (properties). Click the + number and on MouseEvent. Check the release box;


6 Click "+" and Load/unload Movie again. Select "Load Variables into Location" and enter your ASP file name (for example, flash.asp) in the URL entry box. Select target;


7 Finally, select the send using POST in variables, click the "+" number to set the variable, enter "input" in the Variable input box (the name of the first text field), and when the above work is done, you should be in the action box to see the following:


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 form is used to pass variables in the post way;


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 way in which Knownas and surname are passed back is 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 through the URL to flash, in fact, this is a GET method, you do not use ASP can also be passed to a SWF file, as long as this: <param name=movie value= "mymovie.swf?" Myvariable=text+of+my+variable "> then text" Text of my Variable "will appear in the Flash animation in the location specified


For ASP developers, as long as the data needed for Flash is ready, and then use Flash animation features can make a strong web page out. The simplest is to use flash combined with the database to draw a very beautiful pie chart, Anyway, as long as we can imagine, we can make a lot of good things out.



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.