so I'm guessing your constructor is setting these properties from XML? If
you bind to a read only property of an Object, the binding will fire when
object reference changes, so if it was null and then you created the object
the binding would fire once. If you have a method on the object that updates
its properties via XML or some other mechanism, you will have to trigger the
Binding yourself from that method. For example, you would declare your
getter Bindable with a custom event like
[Bindable(event="myPropUpdated")]
public function get myProp():String
{
return _myProp;
}
public function updateProps(xml:XML):void
{
_myProp = [EMAIL PROTECTED];
dispatchEvent(new Event("myPropUpdated"));
}
On Tue, Apr 15, 2008 at 1:20 PM, Dominic Pazula <[EMAIL PROTECTED]> wrote:
> Thanks for the information. I am in the process of moving what I can
> to typed classes. Unfortunately that data comes from our server
> component and it will take a while before our Java guy can get to it
> on his end.
>
> One last question. I have a custom class, extends EventDispatcher,
> declared as [Bindable]. It has a read-only "status" property. I
> have tried binding things to it like:
>
> <mx:Text text="{myCustomObj.status}"/>
>
> In the case above, I cannot get the text to update when the object
> updates. Do I need the class to dispatch a specific event to trigger
> the binding to update?
>
>
> Thanks
> Dominic
>
> --- In [email protected] <flexcoders%40yahoogroups.com>, "Daniel
> Gold" <[EMAIL PROTECTED]>
> wrote:
> >
> > Binding will not work with dynamic objects, which it sounds like
> you're
> > using. I have a feeling your invisible text field trick is only
> working when
> > you switch selectedItem. Seems like if you kept the same item
> selected and
> > the TYPE property changed on that item, the binding would not fire,
> but
> > since selectedItem was in your MXML binding chain, a binding will
> fire
> > anytime you select a different item in the list, then it will pull
> out the
> > TYPE property and update your text field.
> >
> > If you don't really need binding and just need to update when a
> selection
> > changes, you could always listen for the itemClicked property or
> add a
> > ChangeWatcher for the list.selectedItem property and call a
> function that
> > pulls out the TYPE property and updates your currentOp object.
> >
> > On Tue, Apr 15, 2008 at 8:55 AM, Dominic Pazula <[EMAIL PROTECTED]> wrote:
> >
> > > I have a List Component whose dataProvider is an
> ArrayCollection of
> > > generic objects.
> > >
> > > I have another object I would like to bind a property of to a
> > > property to the selectedItem of the List.
> > >
> > > I have:
> > > BindingUtils.bindProperty
> > > (currentOp,"type",this.columnList.selectedItem,"TYPE");
> > >
> > > No go... I see that the binding util cannot work with the property
> > > TYPE on the generic object, does not implement IEventDispatcher,
> > > etc. I get why it doesn't work.
> > >
> > > So if I add
> > > <mx:Text id="selectedType"
> text="{this.columnList.selectedItem.TYPE}"
> > > visable="false"/>
> > >
> > > and
> > > BindingUtils.bindProperty
> (currentOp,"type",this.selectedType,"text");
> > >
> > > it works.
> > >
> > > I would prefer NOT to have a bunch of invisible text fields
> running
> > > around. How can I accomplish this in AS?
> > >
> > > Thanks
> > > Dom
> > >
> > >
> > >
> >
>
>
>