No, it's not unless I am missing something. I did step into the setter
which is triggered when a new value is assigned to comboValue. In fact, I
have changed:

comboValue = _item.value;
ArrayCollection(dataProvider).addItemAt(_item, 0);
to
ArrayCollection(dataProvider).addItemAt(_item, 0);
comboValue = _item.value;

so, in the setter it correctly creates selectedItem.
Interesting that when I check combobox's selectedIndex outside of combo
class it still shows -3 although the selectedItem has a new value.


On Mon, Nov 18, 2013 at 11:55 AM, Alex Harui <[email protected]> wrote:

> Is the value of _item.value changing?
>
> Best thing to do is to step into the setter call.
>
> On 11/18/13 9:40 AM, "mark goldin" <[email protected]> wrote:
>
> >I agree about the getter. But the setter is triggered after this line
> >comboValue
> >= _item.value;
> >
> >
> >On Mon, Nov 18, 2013 at 11:30 AM, Kessler CTR Mark J <
> >[email protected]> wrote:
> >
> >> I believe this is not sending change events for your getter... based on
> >>it
> >> not having a setter that is being triggered.
> >>
> >> -Mark
> >>
> >> -----Original Message-----
> >> From: mark goldin [mailto:[email protected]]
> >> Sent: Monday, November 18, 2013 12:15 PM
> >> To: users
> >> Subject: Re: Combo box and binding
> >>
> >> I tried setting a setter to be Bindable, it did not help.
> >>
> >>
> >> On Mon, Nov 18, 2013 at 11:09 AM, Mark Line <[email protected]> wrote:
> >>
> >> > I think you need the Bindable meta tag on the set function of the
> >>getter
> >> > and setter. i'm not in front of flash builder to test though...
> >> >
> >> >
> >> > On 18 November 2013 16:57, mark goldin <[email protected]> wrote:
> >> >
> >> > > BindingUtils.bindProperty(combobox, "comboValue", model, "field",
> >> true);
> >> > >
> >> > > Here is my relative combobox code:
> >> > > private var _comboValue:*;
> >> > > public function set comboValue(value:*):void
> >> > > {
> >> > >  // simplified
> >> > > for each (var listItem:* in dataProvider){ if (listItem.value] ==
> >> > > _comboValue){ selectedItem = listItem; break; } }
> >> > > }
> >> > > [Bindable]
> >> > > public function get comboValue():*
> >> > > {
> >> > > return _comboValue;
> >> > > }
> >> > > addEventListener(IndexChangeEvent.CHANGING, onChange, false, 0,
> >>true);
> >> > >
> >> > > private function onChange(event:IndexChangeEvent):void
> >> > > {
> >> > >    if (selectedIndex > -1)
> >> > >      comboValue = selectedItem.value;
> >> > >    else  // new item
> >> > >    {
> >> > >         var _item:Object = new Object();
> >> > > _item.value = textInput.text;
> >> > > comboValue = _item.value;
> >> > > ArrayCollection(dataProvider).addItemAt(_item, 0);
> >> > >    }
> >> > > }
> >> > >
> >> > > When I add a new item the underlying model is not getting the new
> >>value
> >> > and
> >> > > I have to manually assign to it:
> >> > > model.field = combobox.selectedItem["value"];
> >> > >
> >> > > Any idea?
> >> > >
> >> > > Thanks
> >> > >
> >> >
> >>
>
>

Reply via email to