Hello all,
I have two listboxes.
Listbox1 is popuplated with title as label, and path as data from an xml file.
Listbox2 is popuplated with Author as label, and path as data from the same xml file.
My goal is to be able to select and highlight the item in listbox1 by selecting a a label from listbox2 and vice versa.
I think that I can use the index, but I couldn’t make it work. Here is the AS
Books= new XML();
Books.ignoreWhite = true;
Books.load(“BooksInfo.xml”);
Books.onLoad =test;
function test(){
Length = Books.firstChild.childNodes.length;
trace (Length);
for(i = 0; i < Length; i++){
lstBooksTitles.addItem(Books.firstChild.childNodes*.attributes.title,Books.firstChild.childNodes*.attributes.path);
lstAuthor.addItem(Books.firstChild.childNodes*.attributes.author,Books.firstChild.childNodes*.attributes.path);
}
};
function displayBookDetails©{
trace(c.getSelectedIndex(c.getSelectedItem().label));
trace(c.getSelectedItem().label);
trace(c.getSelectedItem().data);
}
function displayAuthorDetails©{
trace(c.getSelectedIndex(c.getSelectedItem().label));
trace(c.getSelectedItem().label);
trace(c.getSelectedItem().data);
iIndex = c.getSelectedIndex();
trace (iIndex);
getBookTitle(iIndex);
}
function getBookTitle(iIndex){
trace(lstBooksTitles.getSelectedIndex(iIndex).label);
}
// 3
lstBooksTitles.setChangeHandler(“displayBookDetails”);
lstAuthor.setChangeHandler(“displayAuthorDetails”);
Would you please help me to correct the code.
Thank you for you time and help