flash actionscript:
I have 2 listboxes: "lb_unselected" and "lb_selected". The first thing in the actions is loop through an array populating these two listboxes. There is also an "add" button which, when clicked moves the currently selected item from the "lb_unselected" listbox to the "lb_selected" listbox. The problem is that, although the item is moved to the "lb_selected" listbox, it displays as "," - the label changes to this when it's moved? I am sure this is something to do with the array index? but cannot figure out what exactly. Any insights would be appreciated. // Code that populates both listboxes: for(n=0; n<allItems.length; n++) { is_selected = false; for(i=0; i< allItems[n]['topics'].length; i++) { if(allItems[n]['topics'][i] == topic) { lb_selected.addItem(allItems[n].item_name, allItems[n].item_id); is_selected = true; break; } } // fill Unselected items listbox if(!is_selected){ lb_unselected.addItem(allItems[n].item_name, allItems[n].item_id); } } //Code that the add button activates: // add item function addSubcat(listIndex) { // add item to Selected list box lb_selected.addItem(lb_unselected.getItemAt(listIndex).label, lb_unselected.getItemAt(listIndex).data) // select and sort new item in Selected list box lb_selected.setSelectedIndex(lb_selected.getLength() - 1); lb_selected.sortItemsBy("label", "ASC"); // remove good practice from Unselected listbox lb_unselected.removeItemAt(listIndex); }
Answer: incorrect function names.
Don't see what you're looking for? Try a search.
|