PDA

View Full Version : [AS3] ComboBox problem (first item always repeated?)


papercrate
06-04-2009, 04:59 PM
I'm using SlideShowPro and populating a ComboBox with the SSP Director API.

It is quite simple, but the most frustrating thing is that the first item in the ComboBox list is repeated.

Check out the demo here:
http://slideshowpro.net/demo/SlideShowPro-Combo-Box-Demo/

See how the "Select album" is there twice? It is pretty redundant. I just want it to be the default text of the ComboBox, not in the dropdown as well. Anybody know how to resolve this?

Here is the actionscript:

my_ssp.addEventListener(SSPDataEvent.IMAGE_DATA, onImageData);

//ComboBox navigation
var albums_dp = new DataProvider();

function onGalleryData(event:SSPDataEvent):void {
if (event.type=="galleryData") {
albums_dp.addItem({label: "recent works", data: null});
for (var i=0;i<event.data.length;i++) {
albums_dp.addItem({label: event.data[i][0].title, data: event.data[i][0].id});

}
}

}

my_ssp.addEventListener(SSPDataEvent.GALLERY_DATA, onGalleryData);

nav_cb.dataProvider = albums_dp;

function changeListener(event:Event):void {
my_ssp.loadAlbum(event.target.selectedItem.data,0) ;
}

nav_cb.addEventListener("change", changeListener);

Any ideas are much appreciated. Thanks in advance!