Looks like you bound to _sample_ac and not sample_ac (without the underscore).  (also I wouldn’t pass true/true to new Event, just pass “sampleChanged”).

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of John Crosby
Sent: Thursday, November 03, 2005 12:30 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Problems Databinding to Custom Properties (Flex 2.0)

 

I get the compile warning - 'Unable to detect changes to "_sample_ac".'  and the binding I have set up won't update unless I manually capture the event and update the controls' text property myself.

 

I was under the inpression that Flex would watch for changes and update the binding chain if the getters/setters were set up as in the code below.

 

[Updated Code]

 

package com {
   
    public class DataVO {
        import flash.events.*;
       
        ...

    [Bindable(event="sampleChanged")]

    public function get sample_ac():ArrayCollection
    {
        return _sample_ac;
    }
    public function set sample_ac(value:ArrayCollection):Void
    {
        _sample_ac = value;
        dispatchEvent(new Event("sampleChanged", true, true);
    }
   }
}

TIA

- John


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of JesterXL
Sent: Thursday, November 03, 2005 11:43 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] dispatchEvent troubles (Flex 2.0)

Er, don't know G, haven't done binding in Flex 2 yet, sorry!

 

----- Original Message -----

From: John Crosby

Sent: Thursday, November 03, 2005 11:31 AM

Subject: RE: [flexcoders] dispatchEvent troubles (Flex 2.0)

 

Thanks!

 

That removed the compile error.

I still get the compile warning - 'Unable to detect changes to "_sample_ac".'  and the binding I have set up won't update unless I manually capture the event and update the controls' text property myself.

 

I was under the inpression that Flex would watch for changes and update the binding chain if the getters/setters were set up as in the code below.

 

Thanks again!

- John

 

[Updated Code]

 

package com {
   
    public class DataVO {
        import flash.events.*;
       
        ...

    [Bindable(event="sampleChanged")]

    public function get sample_ac():ArrayCollection
    {
        return _sample_ac;
    }
    public function set sample_ac(value:ArrayCollection):Void
    {
        _sample_ac = value;
        dispatchEvent(new Event("sampleChanged", true, true);
    }
   }
}

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of JesterXL
Sent: Thursday, November 03, 2005 8:14 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] dispatchEvent troubles (Flex 2.0)

Just guessing, but your DataVO doesn't extend EventDispatcher, only Object; try extending him so you'll get all the addEventListener/removeEventListener/dispatchEvent functions.

 

----- Original Message -----

From: John Crosby

Sent: Wednesday, November 02, 2005 10:41 PM

Subject: [flexcoders] dispatchEvent troubles (Flex 2.0)

 

I'm having trouble with dispatchEvent in an AS 3.0 Class:

package com {
   
    public class DataVO {
        import flash.events.*;
       
        ...

        [Bindable("sampleChanged")]

    public function get sample_ac():ArrayCollection
    {
        return _sample_ac;
    }
    public function set sample_ac(value:ArrayCollection):Void
    {
        _sample_ac = value;
        var evt:Event = n! ew Event("sampleChanged", true, true);
        dispatchEvent(evt);
    }
   }
}

I get the compile error: Access of undefined property dispatchEvent

Any help would be appreciated. TIA.

- John Crosby




--
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




Reply via email to