SOLVED: This is weird, but I've got it working.
// shortcut var
var arr:ArrayCollection = ModelLocator.getInstance().arr_selectedPlans;
// if ComboBox is selected, add its label to the AC
// if not selected, remove its label from AC
if(evt.cb.selected)
{
// prevent dupes
if(!arr.contains(evt.cb.label))
{
arr.addItem(evt.cb.label);
}
}
else
{
arr.removeItemAt(arr.getItemIndex(evt.cb.label));
}
// WITHOUT THIS LINE, COMBOBOX WILL NOT UPDATE ITS DISPLAY
ModelLocator.getInstance().arr_selectedPlans.source = arr.toArray();
Should I really have to do this? I thought ArrayCollection was
supposed to have all these magical capabilities... :)
Ben
http://www.returnundefined.com/
--- In [email protected], "ben.clinkinbeard"
<[EMAIL PROTECTED]> wrote:
>
> Hello, I have a ComboBox that is bound to an ArrayCollection. The
> problem is that if I programmatically remove the item that is
> currently being displayed in the CB from the source ArrayCollection,
> the CB doesn't update its display. It removes the item from the list
> so that its not there if I open it, but it displays the old value
> until then. However, if I click the CB to 'activate' it before
> removing the item, it will properly refresh its display and change the
> current item as soon as the underlying data changes.
>
> I have tried all kinds of things to do this programmatically with no
> luck. I've tried calling invalidateDisplay(), invalidateProperties()
> and a few others on the CB after updating the AC.
>
> I know this has to be something simple. What am I missing here?
>
> Thanks in advance,
> Ben
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/