Ah - good it is Cairngorm.

Initially bind the VO to the component.  Well, actually I do bind it's
properties directly to the individual elements of the component initially.

Then what I do is create another Event call something like UpdateVOEvent
and dispatch at the Command level.  This then triggers a standard Command
called something like UpdateVoCommand that you can call from all over the
place to trigger the update.  Currently I'm actually using it to reset big
forms to their original values.  But in answer to your question - the way
I do it is to have a two step process - change the property and then
update the VO.

I think I may have misunderstood the question - how exactly are you
binding a VO to a component without the component knowing which properties
in the VO relate to which elements of the component?

t

> One more question...
>
> How would you bind this update() to the vo in wich we change the
> propertie.
>
> I have VO in the modelLocator, and I change it with command. Then this
> must be updated on the component vo.
>
> How would you bind this?
>
> Thanks,
> Toni
>
>
> --- In flexcoders@yahoogroups.com, [EMAIL PROTECTED] wrote:
>>
>> Hi,
>>
>> I don't know if this helps, but what I've done in the past is to
> bind the
>> VO and then if I need to update it I had the same problem you were
> talking
>> about.  I would change the value, but the VO wouldn't change as the
>> binging goes from the VO to the component, not the other way around.  My
>> little work around was to have a function similar to this (assuming
> the VO
>> is called 'voToChange' of type 'VO')
>>
>> private function update():void
>> {
>>      var holderVO:VO = voToChange;
>>      voToChange = new VO();
>>      voToChange = holderVO;
>> }
>>
>> This then changes the VO so the change will go back to the component.
>> Alternatively if you want to set something on the VO you could
> change the
>> function to somethign like
>>
>> private function setSomthing(something:Object):void
>> {
>>     voToChange.propertyToChange = something;
>>     //Call the update function
>>     update();
>> }
>>
>> I hope I haven't completely misunderstood what you are having
> problems with.
>>
>> Luck,
>>
>> Tim
>>
>> > I understand that. I know how to bind some class. Problem is, that if
>> > I Bind whole VO to one of my components, if I change something in the
>> > VO (only one var) than nothing will change. I don't want to bind all
>> > the properties separately.
>> >
>> > I can make one example for drawing line:
>> >
>> >
>> > [Bindable]
>> > public class LineVO
>> > {
>> >  public var startX:Number;
>> >  public var startY:Number;
>> >  public var endX:Number;
>> >  public var endY:Number;
>> > }
>> >
>> > Than I have one component to draw the line with LineVO.
>> >
>> > var linevo:LineVO=new LineVO();
>> > linevo.startX=0;
>> > linevo.startY=0;
>> > linevo.endX=20;
>> > linevo.endY=30;
>> >
>> > var newLine:Line=new Line();
>> > newLine.vo=linevo;
>> > addChild(newLine);
>> >
>> > I only want to bind the whole linevo, not the properties.
>> >
>> > Now if i change some properties like startX or startY, in the line
>> > should be triggered one function that I bind to.
>> >
>> > It is working for me if I bind the every propertie by itself, like
> this:
>> >
>> > BindingUtils.bindProperty(newLine,"onChange",linevo,"startX");
>> >
>> > That is not O.K., because than I have to bind everything manually.
>> >
>> > I hope that now somebody can help me.
>> >
>> > Thanks,
>> > Toni
>> >
>> >
>> >
>> > --- In flexcoders@yahoogroups.com, "madflexcoder" <brian.joseph31@>
>> > wrote:
>> >>
>> >> Put your [Bindable] tag on top of your class and it will make the
>> >> entire class bindable.
>> >>
>> >> [Bindable]
>> >> public class MyVo
>> >> {
>> >>
>> >> }
>> >>
>> >>
>> >> brian..
>> >>
>> >>
>> >>
>> >>
>> >> --- In flexcoders@yahoogroups.com, "toniabc" <toniabc@> wrote:
>> >> >
>> >> > Hi!
>> >> >
>> >> > I have one problem.
>> >> >
>> >> > I have Value Object that I want to Bind to my custom made
> component. I
>> >> > have no problems to bind every single value from VO to
> component. And
>> >> > if I change something in the VO, that will be changed.
>> >> >
>> >> > But I want to Bind the whole VO (at once, not every value by
> itself).
>> >> > So that I can override the whole VO and changes will be
> automatically
>> >> > trigger the update function in my component. And if I remove
> the VO,
>> >> > than I want to remove my component from view.
>> >> >
>> >> > Thank you,
>> >> > Toni P.
>> >> >
>> >>
>> >
>> >
>> >
>>
>
>
>


Reply via email to