1 Reply Latest reply on Apr 13, 2007 5:51 AM by peterent

    Custom Validator for a Custom Component

      I am having troubling passing values from my custom component to my custom validator (via a model). For some reason when the validate() function is called for the validator the value parameter passed to the validator is not showing the value from my custom component.

      I have attached some example code to illustrate.

      Here is my model:
      <mx:Model id="myModel">

      When I update the value of myTextInput or myDateField the model (as sent to the validator) shows the correct value. When I change the value of myComp the change is not reflected.

      Is there a particular event (or something) being dispatched in the other components to cause the model to get the new value that I need to include in my custom component? I am pretty stuck and would appreciate any help.

      Many thanks
        • 1. Re: Custom Validator for a Custom Component
          peterent Level 2
          Does myComp extend EventDispatcher (or any class which does)? You need to flag the getLength() function as bindable and to dispatch an event:

          public function getLength() : Number
          // does whatever it does

          When you update myComp have it dispatchEvent( new Event("getLengthChange") ) and I think it will work.