Flash message book tutorial

Source: Internet
Author: User
Tags abstract

Note: only the border can be seen during the operation. The name is set in the attribute panel.
Copy the following code to the first frame:
Import fl. controls. dataGridClasses. DataGridColumn;
Import fl. data. DataProvider;
Import flash. events. Event;
System. useCodePage = true;

Var loader: URLLoader = new URLLoader ();
Var txturl: String = "http: // 127.0.0.1/notebook/index. asp ";
Var request: URLRequest = new URLRequest (txturl );
Var listrecord: XML;
Request. method = URLRequestMethod. GET;
Loader. dataFormat = URLLoaderDataFormat. TEXT;
Loader. addEventListener (ProgressEvent. PROGRESS, progressHandler );
Loader. addEventListener (Event. COMPLETE, loader_complete );
Mylist. addEventListener (Event. CHANGE, myDG_change );
Loader. load (request );
Function loader_complete (evt: Event): void {
Listrecord = new XML (loader. data );
Loading. visible = false;
Var contentCol: Maid = new maid ("content ");
ContentCol. headerText = "content abstract ";
ContentCol. width = 120;
ContentCol. sortable = false;
// Var myDG: DataGrid
Var myDP: DataProvider = new DataProvider (listrecord );
Mylist. columns = [contentCol];
Mylist. dataProvider = myDP;
Mylist. sortableColumns;
// MyDG. dataProvider = new dataProvider (listrecord );
}
Function myDG_change (evt: Event ){
Var I: Number = mylist. selectedIndex;
Mycontent.html Text = "name:" + listrecord. record [I]. name + "<br> ";
Mycontent.html Text + = "date:" + listrecord. record [I]. date + "<br> ";
Mycontent.html Text + = "QQ:" + listrecord. record [I]. qq + "<br> ";
Mycontent.html Text + = "email:" + listrecord. record [I]. email + "<br> ";
Mycontent.html Text + = "content:" + listrecord. record [I]. content + "<br> ";
}

Function progressHandler (event: ProgressEvent): void {
Loading. setProgress (event. bytesLoaded * 150/event. bytesTotal, loading. maximum );
}
The test will see the following image

Describe the above code
Import fl. controls. dataGridClasses. DataGridColumn;
Import fl. data. DataProvider;
Import flash. events. Event;
// Import some necessary class libraries for running.
System. useCodePage = true;
// Set the system language support. If this sentence is not provided, Chinese characters will be garbled.
Var loader: URLLoader = new URLLoader ();
// Define an instance loader that loads the data Class URLLoader.
Var txturl: String = "http: // 127.0.0.1/notebook/index. asp ";
// Define the URL string.
Var request: URLRequest = new URLRequest (txturl );
// Define URLRequest, which is used with loader to obtain data from the website.
Var listrecord: XML;
// Define xml to receive data that loader obtains from the website
Request. method = URLRequestMethod. GET;
// Set the data acquisition method to GET in the form label of the webpage.
Loader. dataFormat = URLLoaderDataFormat. TEXT;
// Format the data
Loader. addEventListener (ProgressEvent. PROGRESS, progressHandler );
// Add event handler for loader:
// The event is ProgressEvent. PROGRESS, that is, the data loading PROGRESS.
// Function: progressHandler (see below)
Loader. addEventListener (Event. COMPLETE, loader_complete );
// Add event handler for loader:
// The Event is Event. COMPLETE, that is, the data has been loaded.
// Function: loader_complete (see below)
Mylist. addEventListener (Event. CHANGE, myDG_change );
// Add an event handler for mylist:
// The Event is Event. CHANGE, that is, when the focus of the current list item changes
// Function: myDG_change (see below)
Loader. load (request );
// Start loading data
Function loader_complete (evt: Event): void {
/* Code executed after data loading
/
/
/
*/
Listrecord = new XML (loader. data );
Loading. visible = false;
Var contentCol: Maid = new maid ("content ");
ContentCol. headerText = "content abstract ";
ContentCol. width = 120;
ContentCol. sortable = false;
// Var myDG: DataGrid
Var myDP: DataProvider = new DataProvider (listrecord );
Mylist. columns = [contentCol];
Mylist. dataProvider = myDP;
Mylist. sortableColumns;
// MyDG. dataProvider = new dataProvider (listrecord );
}
Function myDG_change (evt: Event ){
/* Code executed when the message list is clicked
*/
Var I: Number = mylist. selectedIndex;
Mycontent.html Text = "name:" + listrecord. record [I]. name + "<br> ";
Mycontent.html Text + = "date:" + listrecord. record [I]. date + "<br> ";
Mycontent.html Text + = "QQ:" + listrecord. record [I]. qq + "<br> ";
Mycontent.html Text + = "email:" + listrecord. record [I]. email + "<br> ";
Mycontent.html Text + = "content:" + listrecord. record [I]. content + "<br> ";
}

Function progressHandler (event: ProgressEvent): void {
/* Code executed during data loading
*/
Loading. setProgress (event. bytesLoaded * 150/event. bytesTotal, loading. maximum );
}
Note: You can only test the swf file by pressing ctrl + enter (or test the file on the network). A security warning is displayed when you click the generated swf file:

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.