I am having an issue with a combobox.
Everything seems to work fine until I click on the "home" link. Then the box duplicates the items in the list.
I tried to write a function that would add the items on the initial load thinking the addItem code was running again when it enters frame1. Maybe I am still doing it wrong.
Here is the code:Code:stop(); import fl.data.DataProvider; import fl.events.ComponentEvent; import flash.events.Event; var listBuilt:Boolean = false; stage.addEventListener(Event.ENTER_FRAME, buildList); function buildList (evt:Event): void { if (listBuilt == false) { // Add Item to List. my_cb.addItem({data:1, label:"Home"}); my_cb.addItem({data:2, label:"First Link"}); my_cb.addItem({data:3, label:"Second Link"}); listBuilt = true; } else { //do nothing } } // Add Listener. my_cb.addEventListener (Event.CHANGE, getData); function getData(evt:Event): void { gotoAndPlay(evt.currentTarget.selectedItem.data); }




Reply With Quote