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;
};