Thanks to everyone who replied, I think there is probably enough info
here to get a solution implemented. Unfortunately I have been pulled
onto other tasks so I have not had a chance to test these methods, but
I am confident they'll lead me to success.

Thanks again!
Ben

--- In [email protected], Lachlan Cotter <[EMAIL PROTECTED]>
wrote:
>
> Hi Ben,
> 
> Your problem is probably that you have not told Flex when it needs to  
> fire the binding. The binding mechanism works by broadcasting events  
> from the setter methods of bindable properties. If there is no direct  
> setter involved, then Flex does not automatically know to refresh the  
> data to the binding destination.
> 
> The best way I know around this issue is to specify the event type  
> you want to associate with a change to your calculated value, and  
> then fire that event when ever any of the arguments to that method  
> change.
> 
> [Bindable("enabledParamsChanged")]
> private function isEnabled():Boolean {
>       if (A) … if (B) … etc
> }
> 
> Then you need to say something like
> 
> private function set valueOfA (arg) {
>       // Change A here
>       dispatchEvent(new Event("enabledParamsChanged"));
> }
> 
> private function set valueOfB (arg) {
>       // Change B here
>       dispatchEvent(new Event("enabledParamsChanged"));
> }
> 
> Now Flex knows to fire your isEnabled binding when the arguments to  
> the calculation are altered.
> 
> Cheers,
> Lach
> 
> 
> On 29/11/2006, at 1:13 AM, ben.clinkinbeard wrote:
> 
> > There was a similar question asked here recently but my needs are
> > different so I am starting a new thread. My needs are as follows: I
> > have a ComboBox whose enabled state needs to be determined by several
> > factors, thus the need for a custom method. The problem is that this
> > doesn't seem to work, no matter how I try it. Am I missing something
> > or is this just not possible (meaning I have to set a property and
> > bind to that)? Fake sample code below:
> >
> > [Bindable]
> > private function isEnabled():Boolean
> > {
> > if(conditionA)
> > {
> > if(conditionB)
> > {
> > return true;
> > }
> > else
> > {
> > return false;
> > }
> > }
> > }
> >
> > <mx:ComboBox id="cb" enabled="{isEnabled()}"/>
> >
> > Thanks,
> > Ben
>


Reply via email to