XML part
<?xml version="1.0" encoding="utf-8"?>
<li>
<id>
<pp>1. What is the website of China 114 Huangye Guigang Station? </pp>
<aa></aa>
<aa>gg.</aa>
<aa></aa>
<aa></aa>
</id>
<id>
<pp>2. What is the contact number of China 114 Yellow Pages? </pp>
<aa>0775—4320568</aa>
<aa>0775—4553709</aa>
<aa>0775—4563709</aa>
<aa>114</aa>
</id>
<id>
<pp>3. What is the customer service QQ of China 114 Yellow Pages Guigang Operation Center? </pp>
<aa>10000</aa>
<aa>380463801</aa>
<aa>1015651717</aa>
<aa>854512401</aa>
</id>
<id>
<pp>4. What is the head office of China 114 Yellow Pages? </pp>
<aa>China Mobile</aa>
<aa>China Telecom</aa>
<aa>China 114 Number Pepsi</aa>
<aa>Beijing Internet Starry Sky Culture Communication Co., Ltd.</aa>
</id>
</li>
AS3 class - myform, placed in a myfirst package. Generate a form that is mainly composed of ComboBox components,
package myfirst{
import ;
import .*;
import .*;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
public class myform extends Sprite {
= true;
var a_form:String="";
var a_num:int;
var a_array:Array=new Array();
public function myform():void {
var loader:URLLoader=new URLLoader;
configureListeners(loader);
var request:URLRequest=new URLRequest("");
try {
(request);
} catch (error:Error) {
trace("Unable to load requested document.");
}
}
private function configureListeners(dispatcher:IEventDispatcher):void {
(,completeHandler);
}
private function completeHandler(event:Event):void {
=true;
var loader:URLLoader=URLLoader();
var myxml:XML=XML(());
a_num=();
for (var i:int=0; i <= a_num - 1; i++) {
var p_text:TextField=new TextField();
p_text.text=[i].pp;
p_text.width=250;
p_text.y=i*50;
addChild(p_text);
var mycombobox:ComboBox=new ComboBox();
=180;
(20,20+i*50);
="Select answer";
(, cardSelected);
addChild(mycombobox);
for (var j:int=0; j<=3; j++) {
({label:[i].aa[j]});
}
}
}
private function cardSelected(event:Event):void {
var cb:ComboBox= as ComboBox;
var cbindex:int=getChildIndex(cb)/2;
var aa:int=;
a_array[cbindex]=(String(aa));
}
public function mm(event:Event):void {
for (var k:int=0; k<=a_num-1; k++) {
a_form+=String(a_array[k]);
}
trace(a_form);
}
}
}
Another class url_asp that is also placed in the myfirst package is mainly used to connect to ASP files
package myfirst{
import ;
import .*;
import .*;
import ;
import ;
import ;
import ;
import ;
public class url_asp extends Sprite {
public function url_asp() {
=true;
var form_name:TextField=new TextField();
var form_tel:TextField=new TextField();
form_name.text="name:";
form_tel.text="Tel:";
form_name.x=100;
form_name.y=350;
form_tel.x=100;
form_tel.y=300;
addChild(form_name);
addChild(form_tel);
var form_value=new myform();
form_value.x=10;
form_value.y=10;
addChild(form_value);
var myname:String="";
var telephone:String="";
var a_form:String ="";
var variables:URLVariables=new URLVariables();
var myrequest:URLRequest=new URLRequest("");
var loader:URLLoader = new URLLoader();
var mybutton1:Button=new Button();
=180;
=250;
="Confirm the answer";
(,form_value.mm);
addChild(mybutton1);
var myname_input:TextInput=new TextInput();
myname_input.x=180;
myname_input.y=350;
addChild(myname_input);
var telephone_input:TextInput=new TextInput();
telephone_input.x=180;
telephone_input.y=300;
addChild(telephone_input);
var mybutton:Button=new Button();
=180;
=400;
="Submit information";
addChild(mybutton);
(,onclik);
function onclik(event:Event):void {
=myname_input.text;
=telephone_input.text;
variables.a_form= form_value.a_form;
trace( form_value.a_form);
=variables;
=;//Specify that the URLRequest object is POST.
= ;
(myrequest);//Send data
}
}
}
}
To create a FLA, write myfirst.url_asp in the document class.
ASP part, three files.
------
asp file 1 database connection
<%
Dim conn
Set conn=("")
"Driver={Microsoft Access Driver (*.mdb)};DBQ=" & ("")
%>
------
Asp file 2 saves data
<!-- #include file= -->
<%
if request("myname")="" then
("no data")
()
else
myname=Request("myname")
telephone=Request("telephone")
a_form=Request("a_form")
sql="Insert into data (myname,telephone,a_form) values ('"&myname&"','"&telephone&"','"&a_form&"')"
(sql)
Set conn=Nothing
"ok"
end if
%>
----------
Asp File 3 View answerer
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unt titled document</title>
<style type="text/css">
<!--
body {
background-color: #B57202;
}
-->
</style></head>
<!-- #include file="" -->
<body>
<%
dim rs_zl
set rs_zl =("")
rs_zl.open "select * from data",conn,1,1
rs_zl.pagesize=15
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rs_zl.pagecount then epage=rs_zl.pagecount
else
epage=1
end if
rs_zl.absolutepage=epage
%>
<table width="750" border="0" cellpadding="2" cellspacing="2">
<tr bgcolor="#666666">
<td>ID</td>
<td>Name</td>
<td>Tel</td>
<td>Answer</td>
<td> </td>
</tr>
<%
for i=0 to rs_zl.pagesize-1
if rs_zl.eof then exit for
%>
<tr bgcolor="#666666">
<td><%=rs_zl("id")%></td>
<td><%=rs_zl("myname")%></td>
<td><%=rs_zl("telephone")%></td>
<td><%=rs_zl("a_form")%></td>
<td> </td>
</tr>
<%
rs_zl.movenext
next
%>
</table>
<table width="530">
<tr>
<td width="124" height="38"> </td>
<td width="259">
<p align="center">
<a href="">Home</a>
<a href="?page=<%=epage-1%>">Previous page</a>
<a href="?page=<%=epage+1%>">The next page</a>
<a href="?page=<%=rs_zl.pagecount%>">Last Page</a>
</p>
<p align="center">Now is the <%=epage%> page, there are a total of <%=rs_zl.pagecount%> pages</p>
</td>
<td width="131"> </td>
</tr>
</table>
<%
rs_zl.close
set rs_zl = nothing
()
%>
</body>
</html>
Copy the codeThe code is as follows:
<?xml version="1.0" encoding="utf-8"?>
<li>
<id>
<pp>1. What is the website of China 114 Huangye Guigang Station? </pp>
<aa></aa>
<aa>gg.</aa>
<aa></aa>
<aa></aa>
</id>
<id>
<pp>2. What is the contact number of China 114 Yellow Pages? </pp>
<aa>0775—4320568</aa>
<aa>0775—4553709</aa>
<aa>0775—4563709</aa>
<aa>114</aa>
</id>
<id>
<pp>3. What is the customer service QQ of China 114 Yellow Pages Guigang Operation Center? </pp>
<aa>10000</aa>
<aa>380463801</aa>
<aa>1015651717</aa>
<aa>854512401</aa>
</id>
<id>
<pp>4. What is the head office of China 114 Yellow Pages? </pp>
<aa>China Mobile</aa>
<aa>China Telecom</aa>
<aa>China 114 Number Pepsi</aa>
<aa>Beijing Internet Starry Sky Culture Communication Co., Ltd.</aa>
</id>
</li>
AS3 class - myform, placed in a myfirst package. Generate a form that is mainly composed of ComboBox components,
Copy the codeThe code is as follows:
package myfirst{
import ;
import .*;
import .*;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
public class myform extends Sprite {
= true;
var a_form:String="";
var a_num:int;
var a_array:Array=new Array();
public function myform():void {
var loader:URLLoader=new URLLoader;
configureListeners(loader);
var request:URLRequest=new URLRequest("");
try {
(request);
} catch (error:Error) {
trace("Unable to load requested document.");
}
}
private function configureListeners(dispatcher:IEventDispatcher):void {
(,completeHandler);
}
private function completeHandler(event:Event):void {
=true;
var loader:URLLoader=URLLoader();
var myxml:XML=XML(());
a_num=();
for (var i:int=0; i <= a_num - 1; i++) {
var p_text:TextField=new TextField();
p_text.text=[i].pp;
p_text.width=250;
p_text.y=i*50;
addChild(p_text);
var mycombobox:ComboBox=new ComboBox();
=180;
(20,20+i*50);
="Select answer";
(, cardSelected);
addChild(mycombobox);
for (var j:int=0; j<=3; j++) {
({label:[i].aa[j]});
}
}
}
private function cardSelected(event:Event):void {
var cb:ComboBox= as ComboBox;
var cbindex:int=getChildIndex(cb)/2;
var aa:int=;
a_array[cbindex]=(String(aa));
}
public function mm(event:Event):void {
for (var k:int=0; k<=a_num-1; k++) {
a_form+=String(a_array[k]);
}
trace(a_form);
}
}
}
Another class url_asp that is also placed in the myfirst package is mainly used to connect to ASP files
Copy the codeThe code is as follows:
package myfirst{
import ;
import .*;
import .*;
import ;
import ;
import ;
import ;
import ;
public class url_asp extends Sprite {
public function url_asp() {
=true;
var form_name:TextField=new TextField();
var form_tel:TextField=new TextField();
form_name.text="name:";
form_tel.text="Tel:";
form_name.x=100;
form_name.y=350;
form_tel.x=100;
form_tel.y=300;
addChild(form_name);
addChild(form_tel);
var form_value=new myform();
form_value.x=10;
form_value.y=10;
addChild(form_value);
var myname:String="";
var telephone:String="";
var a_form:String ="";
var variables:URLVariables=new URLVariables();
var myrequest:URLRequest=new URLRequest("");
var loader:URLLoader = new URLLoader();
var mybutton1:Button=new Button();
=180;
=250;
="Confirm the answer";
(,form_value.mm);
addChild(mybutton1);
var myname_input:TextInput=new TextInput();
myname_input.x=180;
myname_input.y=350;
addChild(myname_input);
var telephone_input:TextInput=new TextInput();
telephone_input.x=180;
telephone_input.y=300;
addChild(telephone_input);
var mybutton:Button=new Button();
=180;
=400;
="Submit information";
addChild(mybutton);
(,onclik);
function onclik(event:Event):void {
=myname_input.text;
=telephone_input.text;
variables.a_form= form_value.a_form;
trace( form_value.a_form);
=variables;
=;//Specify that the URLRequest object is POST.
= ;
(myrequest);//Send data
}
}
}
}
To create a FLA, write myfirst.url_asp in the document class.
ASP part, three files.
------
asp file 1 database connection
Copy the codeThe code is as follows:
<%
Dim conn
Set conn=("")
"Driver={Microsoft Access Driver (*.mdb)};DBQ=" & ("")
%>
------
Asp file 2 saves data
Copy the codeThe code is as follows:
<!-- #include file= -->
<%
if request("myname")="" then
("no data")
()
else
myname=Request("myname")
telephone=Request("telephone")
a_form=Request("a_form")
sql="Insert into data (myname,telephone,a_form) values ('"&myname&"','"&telephone&"','"&a_form&"')"
(sql)
Set conn=Nothing
"ok"
end if
%>
----------
Asp File 3 View answerer
Copy the codeThe code is as follows:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unt titled document</title>
<style type="text/css">
<!--
body {
background-color: #B57202;
}
-->
</style></head>
<!-- #include file="" -->
<body>
<%
dim rs_zl
set rs_zl =("")
rs_zl.open "select * from data",conn,1,1
rs_zl.pagesize=15
if request("page")<>"" then
epage=cint(request("page"))
if epage<1 then epage=1
if epage>rs_zl.pagecount then epage=rs_zl.pagecount
else
epage=1
end if
rs_zl.absolutepage=epage
%>
<table width="750" border="0" cellpadding="2" cellspacing="2">
<tr bgcolor="#666666">
<td>ID</td>
<td>Name</td>
<td>Tel</td>
<td>Answer</td>
<td> </td>
</tr>
<%
for i=0 to rs_zl.pagesize-1
if rs_zl.eof then exit for
%>
<tr bgcolor="#666666">
<td><%=rs_zl("id")%></td>
<td><%=rs_zl("myname")%></td>
<td><%=rs_zl("telephone")%></td>
<td><%=rs_zl("a_form")%></td>
<td> </td>
</tr>
<%
rs_zl.movenext
next
%>
</table>
<table width="530">
<tr>
<td width="124" height="38"> </td>
<td width="259">
<p align="center">
<a href="">Home</a>
<a href="?page=<%=epage-1%>">Previous page</a>
<a href="?page=<%=epage+1%>">The next page</a>
<a href="?page=<%=rs_zl.pagecount%>">Last Page</a>
</p>
<p align="center">Now is the <%=epage%> page, there are a total of <%=rs_zl.pagecount%> pages</p>
</td>
<td width="131"> </td>
</tr>
</table>
<%
rs_zl.close
set rs_zl = nothing
()
%>
</body>
</html>