This article introduces a new method of using ASP technology to realize database query in Flash, which not only hides the client completely. asp program, and Flash's ease of use, graphics make your Web page unique.
Basic principle
1.Flash method of handling external variables
Flash uses the string specified by the URL in the frame properties as its own variable and its value, which can be either a CGI program or an ASP program, and the output string must be defined in the following format:
company=macromedia&address=600+townsend&
city=san+francisco&zip=94103
After the string is imported into flash, it is divided into 4 variables and given different values, namely:
This format is easy to implement using the Server.URLEncode method in ASP, and you can also implement it by programming:
<% @Language = "VBScript"% >
<%
Option Explicit
Dim var (3), I,count
I=0
Count=3
var (0) = "Red"
var (1) = "Yellow"
var (2) = "Blue"
Do While i< count
Response.Write "var" &i& "=" &var (i) & "&"
I=i+1
Loop
Response.Write "I=" &I
% >
The result of implementing this ASP program is:
Var0=red&var1=yellow&var2=blue&i=3
2. Transfer data between ASP and Flash
After your ASP program produces the string in the format above, you can use the action description of Load variables ("myscript.asp", 0) to pass it into Flash (Figure 1):
Of these, 0 means that the layer in which the animation is mounted is the first layer, 1 is the second layer, and so on.
Using the Load variables ("myscript.asp", 0,vars=post) Action description, ASP can use the following two methods to extract data from Flash:
1, Request.Form ("flash_var_1")
2. Request ("flash_var_1")
Using the Load variables ("myscript.asp", 0,vars=get) Action Description, ASP takes the data out of flash by means of:
Request.QueryString ("flash_var_1")
Example production
Let's take the telephone query as an example to make a Web page.
1. Create a database
Open Access 2000, create a database named Yjytelep.mdb, and design a table with the phone number of employees in this unit, the table name is YJYTELEP, the format is as follows:
Saves the table and database to the specified directory, such as c:estasp.
2. Create Web pages with Flash
① Open Flash 4 and create a phone query screen in frame 1, as shown in Figure 2. Right-click on the text edit box →properties→varible Enter the variable name NAMESTR; To prevent the animation from playing down, select "Stop" in frame 1→properties→action so that only if you enter a name and press the "Query" button, The animation will continue to play. On the Query button, right-click the mouse →properties→action description as:
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