--- In flexcoders@yahoogroups.com, Mark Carter <[EMAIL PROTECTED]> wrote:
>
> 
> Thanks for that Amy.
> 
> Doesn't that only work if you have a set isAllowed() as well?

No.  There is intentionally no setter function for isAllowed for the 
reason you outline below:

> Unfortunately, in my scenario, isAllowed() is not set in this kind 
of way -
> its more of a calculation based on various vars elsewhere (some
> non-bindable).

Yes, that's why you dispatch the binding event any time one of the 
variables involved in the calculation changes, to tell Flex it needs 
to go look at the getter function to see what the new variable is.  
How else do you think Flex is going to just "know" to run the 
function?

Although you did have a point in your first statement above that 
another way to do it would be to simply run your setter function 
every time the value changes and let the normal binding mechanism do 
its thing.  However, using the getter only approach has these 
advantages:

1)  Limits the binding trigger to only your custom event, which means 
that any other more normal bindings you have aren't going to fire 
when your custom binding fires (more efficient)
2)  For this to work, it has to be a public getter, which means a 
public setter.  So if you use a public setter, you run the risk that 
someone using your component could try to set that value 
inappropriately.

You might find this presentation informative

http://link.brightcove.com/services/player/bcpid1733261879?
bclid=1729365228&bctid=1741212660

HTH;

Amy

Reply via email to