问题描述:

Currently I have a list component which is automatically populated with data from a mySQL database. Code for this is shown below.

Is it possible to select a variable from the list and store it as a seperate variable? Thus enabling me to display it back to the user when required.

var theXML:XML = new XML();

theXML.ignoreWhite = true;

theXML.onLoad = function() {

var nodes = this.firstChild.childNodes;

for(i=0;i<nodes.length;i++) {

theList.addItem(nodes[i].firstChild.nodeValue,i);

}

}

theXML.load("http://localhost/fyptest/products.php");

Thanks

网友答案:

You can access the list data with getItemAt(n) where n is the index of the row you want. You can get more details and a example here.

For example in your case var myLabel = theList.getItemAt(0) will return the first item value.

相关阅读:
Top