I have two Lists (components) on stage. The first one (mainList populates from an XML called topics.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<topics>
<topic url="topic1.xml" desc="Topic 1" />
<topic url="topic2.xml" desc="Topic 2" />
<topic url="topic3.xml" desc="Topic 3" />
<topic url="topic4.xml" desc="Topic 4" />
<topic url="topic5.xml" desc="Topic 5" />
</topics>
on event handler change, I want to load the second list on the other list component, called subList…It’s not loading…:*(
I believe it’s because when it reads the data from my topics list, it reads topic1.xml instead of “topic1.xml” ( reads without the quotes).
If I unquote line v.list.load(“subtopic.xml”), it works, but I need it to be loaded from the XML…
import mx.controls.Menu;
var vlist:XML = new XML();
vlist.ignoreWhite = true;
vlist.onLoad = function() {
var subTopics:Array = this.firstChild.childNodes;
for(i=0;i<subTopics.length;i++) {
subList.addItem(subTopics*.attributes.desc,subTopics*.attributes.url);
}
Loader.load(subList.getItemAt(0).data);
subList.selectedIndex = 0;
}
var vidList:Object = new Object();
vidList.change = function() {
videoLoader.load(subList.getItemAt(subList.selectedIndex).data);
}
subList.addEventListener("change",vidList);
//vlist.load("subtopic.xml");
var mlist:XML = new XML();
mlist.ignoreWhite = true;
mlist.onLoad = function() {
var topics:Array = this.firstChild.childNodes;
for(i=0;i<topics.length;i++) {
mainList.addItem(topics*.attributes.desc,topics*.attributes.url);
}
}
var cmList:Object = new Object();
cmList.change = function() {
vList.load(mainList.getItemAt(mainList.selectedIndex).data);
trace(mainList.getItemAt(mainList.selectedIndex).data);
}
mainList.addEventListener("change",cmList);
mlist.load("topic.xml");
Any ideas?
I’m not attaching the file (due to file size), but if anybody wants to try to help, just drag two instances of List component to stage and name them mainList and subList.
Thanks!!