probleme setting value in a variable via a combobox
Hello evrybody! i have a probleme , my probleme is that my string LINK at the end of the script is undefined it should change when i select the categories with my combo box Can someone help me please ???
here is the xml :category.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<slideshow>
<area title1="10 Last updated" link1="lastupdated.php"/>
<area title1="Specials" link1="special.php"/>
</slideshow>
here is the scrpt
function Tload(string) {
url = string;
}var link1:Array = new Array();
var LINK:String;var x:XML = new XML();
x.ignoreWhite = true;
x.onLoad = function(success) {
var urls:Array = this.firstChild.childNodes;
for (i=0; i<urls.length; i++) {
_root.link1.push(urls.attributes.link1);
}
Tload(link1[0]);
_root.LINK=url;};
x.load("category.xml");//Create Listener Object.
var cbListener:Object = new Object();
// Assign function to Listener Object.
cbListener.change = function(event_obj:Object) {
trace(select.selectedItem.label);
if (select.selectedItem.label == "Last updated") {
_root.Tload(link1[0]);
//trace(url);
} else if (select.selectedItem.label == "Special") {
_root.Tload(link1[1]);
//trace(url);
}
_root.LINK= url;
trace(LINK);//here it work
};//add eventListener
select.addEventListener("change",cbListener);
//here is my problem:
trace(LINK);//here it doesnt trace my string LINK ?? so my function Tload(LINK) bellow doesnt work
Tload(LINK);