> simple combination of [Bindable]/getter/setter methods to get Flex
> Builder to do all this automatically but ho hum...!

FB is very GUI orientated, one reason I don't miss it that much on Linux.
Now I see the next rev. will have things like refactoring support, so it
might
become a bit more of a pain not to have it...


It's got nothing to do with Flex Builder and everything to do with the Flex
compiler (mxmlc). Bindings can be setup without Flex Builder...

Nick, the pattern I would recommend is this:

private var __myvar:Number;

[Bindable("myvarChanged")]
public function get myvar():Number { return _myvar; }

protected function get _myvar():Number { return __myvar; }
protected function set _myvar(value:Number):void { __myvar = value;
dispatchEvent(new Event('myvarChanged")); }

This will get you a public read-only property ("myvar") and a protected (or
could be made private) read/write property ("_myvar") which is all backed by
the private (and you probably never to directly touch it) "__myvar" (note
the double-underscore).

The upside of this pattern is that all of your implementation code looks
like the standard "underscore indicates a protected/private member" while
not having to scatter dispatchEvent calls all over your code. It also has
the advantage of probably not requiring you to modify any existing code that
uses "_myvar" with a single underscore.

Just a suggestion...

Troy.

Reply via email to