kirupa
May 27th, 2003, 08:22 PM
Hey everyone,
I have a combobox that displays a list of items from an array (we'll call this Array1). Of course, an item can be selected, and the user is displayed a small output describing the item that was selected.
I created another array that contains the URL for items in the above array, Array1. How can I get the index value of a selected item from Array1? Here is the code I used: resources = new Array("Flash Developer . NL", "OutsideOfSociety", "Fonts for Flash", "Wildform", "CoolHomePages", "FlashHeaven", "Flash4All");
links = new Array("http://www.flashdeveloper.nl", "http://outsideofsociety.idz.net", "http://www.fontsforflash.com", "http://www.wildform.com", "http://www.coolhomepages.com", "http://www.flasheaven.de", "http://www.flash4all.de");
for (i=0; i<resources.length; i++) {
flash.addItem(resources[i]);
}
function listDisplay(component) {
list = component.getSelectedItem().label;
trace(list);
// location = component.getSelectedItem().number;
// trace(location);
}
flash.setChangeHandler("listDisplay");
For example, if I selecte FontsForFlash, Flash outputs Fonts for Flash in the Output Window. How can I display the array position of Fonts for Flash instead of the name Fonts for Flash?
Thanks!
Kirupa :ub:
I have a combobox that displays a list of items from an array (we'll call this Array1). Of course, an item can be selected, and the user is displayed a small output describing the item that was selected.
I created another array that contains the URL for items in the above array, Array1. How can I get the index value of a selected item from Array1? Here is the code I used: resources = new Array("Flash Developer . NL", "OutsideOfSociety", "Fonts for Flash", "Wildform", "CoolHomePages", "FlashHeaven", "Flash4All");
links = new Array("http://www.flashdeveloper.nl", "http://outsideofsociety.idz.net", "http://www.fontsforflash.com", "http://www.wildform.com", "http://www.coolhomepages.com", "http://www.flasheaven.de", "http://www.flash4all.de");
for (i=0; i<resources.length; i++) {
flash.addItem(resources[i]);
}
function listDisplay(component) {
list = component.getSelectedItem().label;
trace(list);
// location = component.getSelectedItem().number;
// trace(location);
}
flash.setChangeHandler("listDisplay");
For example, if I selecte FontsForFlash, Flash outputs Fonts for Flash in the Output Window. How can I display the array position of Fonts for Flash instead of the name Fonts for Flash?
Thanks!
Kirupa :ub: