Create test. aspx content on the server:
<% @ Page Language = "C #" codefile = "test. aspx. cs" autoeventwireup = "false" inherits = "test" %>
Test. aspx. CS content:
Public partial class test: system. Web. UI. Page
{
Private void page_load (Object sender, system. eventargs E)
{
// Define dataset and access the database here.
Dataset DS = new dataset ();
DS = // function for accessing the database ();
// Convert dataset to XML and send it back here.
Response. Write (Ds. getxml ());
}
}
Flash end:
Create a new flash file in the Action column 3.0.
Windows ---> components --> pull ird to the interface. Name: ADG
In the first action
Write down the followingCode
Import Fl. Controls. datagridclasses. datagridcolumn;
Import Fl. Data. dataprovider;
Import flash.net .*;
Import flash. display .*;
Import flash. display. Sprite;
Import flash.net. URLRequest;
Import flash.net. urlvariables;
Import flash.net. sendtourl;
Import flash. External. externalinterface;
Import flash. xml. xmldocument;
Import flash. xml. xmlnode;
Import flash. xml. xmlnodetype;
VaR Loader: urlloader = new urlloader ();
VaR urlprefix: String = "http: // ITD-Cecilia/website/test. aspx"; // http: // ITD-Cecilia/website/test. aspx is the server address
Getresult1 ();
Function getresult1 (){
VaR URL: String = urlprefix;
VaR request: URLRequest = new URLRequest (URL );
Trace ("sendtourl );
VaR Loader: urlloader = new urlloader ();
Loader. dataformat = urlloaderdataformat. text;
Configurelisteners (loader );
Loader. Load (request );
Stop ();
}
Function configurelisteners (Dispatcher: ieventdispatcher): void {
Dispatcher. addeventlistener (event. Complete, completehandler );
Dispatcher. addeventlistener (event. Open, openhandler );
Dispatcher. addeventlistener (progressevent. Progress, progresshandler );
Dispatcher. addeventlistener (securityerrorevent. security_error, securityerrorhandler );
Dispatcher. addeventlistener (httpstatusevent. http_status, httpstatushandler );
Dispatcher. addeventlistener (ioerrorevent. io_error, ioerrorhandler );
}
Function completehandler (Event: Event): void {
VaR Loader: urlloader=urlloader(event.tar get );
Trace ("completehandler:" + loader. data );
VaR teamxml: xml = New XML (loader. data );
VaR roomidcol: Maid = new maid ("roomid ");
Roomidcol. headertext = "ID ";
Roomidcol. width = 20;
VaR roomnamecol: Maid = new maid ("roomname ");
Roomnamecol. headertext = "name ";
Roomnamecol. width = 30;
VaR roomdeccol: Maid = new maid ("roomdescription ");
Roomdeccol. headertext = "dec ";
Roomdeccol. width = 30;
VaR roomlocatcol: Maid = new maid ("roomlocation ");
Roomlocatcol. headertext = "locat ";
Roomlocatcol. width = 30;
VaR roomoffcol: Maid = new maid ("Office ");
Roomoffcol. headertext = "office ";
Roomoffcol. width = 30;
VaR roomremarkcol: Maid = new maid ("remark ");
Roomremarkcol. headertext = "remark ";
Roomremarkcol. width = 30;
VaR roomcbcol: Maid = new maid ("createdby ");
Roomcbcol. headertext = "createdby ";
Roomcbcol. width = 30;
VaR roomdccol: Maid = new maid ("datecreated ");
Roomdccol. headertext = "datecreated ";
Roomdccol. width = 30;
VaR mydp: dataprovider = new dataprovider (teamxml );
ADG. Columns = [roomidcol, roomnamecol, roomdeccol, roomlocatcol, roomoffcol, roomremarkcol, roomcbcol, roomdccol];
ADG. width = 700;
ADG. dataprovider = mydp;
ADG. rowcount = ADG. length;
}
Function openhandler (Event: Event): void {
Trace ("openhandler:" + Event );
}
Function progresshandler (Event: progressevent): void {
Trace ("progresshandler loaded:" + event. bytesloaded + "Total:" + event. bytestotal );
}
Function securityerrorhandler (Event: securityerrorevent): void {
Trace ("securityerrorhandler:" + Event );
}
Function httpstatushandler (Event: httpstatusevent): void {
Trace ("httpstatushandler:" + Event );
}
Function ioerrorhandler (Event: ioerrorevent): void {
Trace ("ioerrorhandler:" + Event );
}
After running, the following results are obtained: