I thought the point of the dataProvider method for a combobox was so that I could simply edit the array linked to a combobox and have the combobox always follow what was in the array. I seem to have to keep re-assigning the dataprovider for it to work though.

Example:
Create a single dropdown box with the ID of 'cb_prodline'

Code in frame1:
PHP Code:
var dp_prodline:Array = [];

cb_prodline.dataProvider dp_prodline;

dp_prodline.push({label:"animal"});
dp_prodline.push({label:"vegetable"});
dp_prodline.push({label:"mineral"});

dp_prodline = [];

trace("checking labels in dp_prodline")
for (var 
i in dp_prodline){
    
trace(dp_prodline[i].label);

My logic would say that this combobox should be empty. The line dp_prodline=[] should have cleared it, right? The trace of the dp_prodline array is empty, but the combobox still has the three items in it. I know the tracing code works okay because if I don't empty the array, it traces fine.

If I add another
cb_prodline.dataProvider = dp_prodline;
at the end of the file, then the combobox gets emptied.

I just don't have a clue when I am supposed to redefine the dataProvider and when I don't. I didn't have to redefine it to have the items added to the list, but I did to have them erased from the list.

The inconistencies worry me that I will come across other problems down the road if I use dataProvider, but I really like the idea of dealing with an array of objects instead of a clunky combobox. I get even more worried when in the above example, anytime after the dp_prodline=[] line I can add NEW items to my dataProvider array and the combobox won't change until I re-assign it.

Can anyone shed light on this?