The dynamic generation method adds data to the LIST by loading XML.

Source: Internet
Author: User

The dynamic generation method adds data to the LIST by loading XML.

// Solve the garbled problem...
System. useCodepage = true;
// Define doc_xml as an XML class;
Var doc_xml: XML = new XML ();
// Ignore spaces.
Doc_xml.ignoreWhite = true;
Doc_xml.onLoad = _ root. xmlload;
// The initial file is "renming. xml "...
_Root.doc _ xml. load ("renming. xml ");
Function xmlload (){
Var childnodes = this. firstChild. childNodes;
// Prevent the addition of the base program. The meaning of this sentence is to make the XML loaded by my_list different each time.
_ Root. my_list.removeAll ();
For (var I: Number = 0; I <childnodes. length; I ++ ){
_ Root. my_list.addItem (childnodes [I]. attributes. label, childnodes [I]. attributes. data );
}
}
Click the button to load different XML files

// When the place name definition button is triggered, place names are loaded...
Diming. onRelease = function (){
_Root.doc _ xml. load ("diming. xml ");
};
Renming. onRelease = function (){
_Root.doc _ xml. load ("renming. xml ");
};
Shijian. onRelease = function (){
_Root.doc _ xml. load ("shijian. xml ");
};

Call the object after the mouse click and the data of the object to be called:

_ Root. onEnterFrame = function (){
Show_txt_label = _ root. my_list.selectedItem.label;
Show_txt_data = _ root. my_list.selectedItem.data;
};

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.