I have a listbox component called “policytext” on my stage. I have some XML info loaded into it, which works fine. The problem occurs when i try to make each one a link. I made an event listener that doesnt want to work. Could someone look at this code and tell me what im doing wrong? I’ve tried both click and change for the event and both don’t work.
var pol:Object = new Object();
pol.change = function(){
getURL(policylist.getItemAt(policylist.selectedIndex).url);
}
policylist.addEventListener("change",pol);
My entire AS code is this:
var vlist:XML = new XML;
vlist.ignoreWhite = true;
vlist.onLoad = function(){
var items:Array = this.firstChild.childNodes;
for(i=0;i<items.length;i++){
if(items*.attributes.type == "policy"){
policylist.addItem(items*.attributes.name,items*.attributes.url);
}
if(items*.attributes.type == "procedure"){
procedurelist.addItem(items*.attributes.name,items*.attributes.url);
}
if(items*.attributes.type == "link"){
linklist.addItem(items*.attributes.name,items*.attributes.url);
}
if(items*.attributes.type == "download"){
downloadlist.addItem(items*.attributes.name,items*.attributes.url);
}
}
}
var pol:Object = new Object();
pol.change = function(){
getURL(policylist.getItemAt(policylist.selectedIndex).url);
}
policylist.addEventListener("change",pol);
vlist.load("../itnavigation.xml");
The space in the selected index is a formatting error from the forum. I dont have that space in my code.