Comments on: Binding with Getters and Setters http://www.adamflater.net/2007/08/23/binding-with-getters-and-setting/ Tech, UX, Design Wed, 04 Jan 2012 21:31:56 +0000 hourly 1 http://wordpress.org/?v=3.5.1 By: rob http://www.adamflater.net/2007/08/23/binding-with-getters-and-setting/#comment-22 rob Wed, 01 Jul 2009 15:12:18 +0000 http://www.adamflater.net/?p=14#comment-22 Thanks Adam, making the setter private was a diamond bullet..! :-)

rob

]]>
By: Adam Flater - effectiveUI http://www.adamflater.net/2007/08/23/binding-with-getters-and-setting/#comment-21 Adam Flater - effectiveUI Wed, 28 Nov 2007 15:59:00 +0000 http://www.adamflater.net/?p=14#comment-21 Interesting.. thanks for the comment. I’m using the Flex 3 SDK primarily, so maybe that bug is fixed the new compiler.

]]>
By: JabbyPanda http://www.adamflater.net/2007/08/23/binding-with-getters-and-setting/#comment-20 JabbyPanda Tue, 27 Nov 2007 16:45:00 +0000 http://www.adamflater.net/?p=14#comment-20 AFAIK, you cannot use setter and getter defined in a different scope of visibility because of the bug 174646 in “mxmlc” compiler documented here:

http://kb.adobe.com/selfservice/viewContent.do?externalId=4a146409&sliceId=2

“If a class contains accessor functions with different access control namespace attributes, (for example, aprotected setter and a public getter) using one of them causes a compile-time-error, for example,Compiler-Error 1000: Ambiguous reference to myVar”

The workaround is to rename your getter or setter function to avoid the mismatch

]]>
By: Adam Flater - effectiveUI http://www.adamflater.net/2007/08/23/binding-with-getters-and-setting/#comment-19 Adam Flater - effectiveUI Thu, 23 Aug 2007 22:42:00 +0000 http://www.adamflater.net/?p=14#comment-19 Yeah, that’s totally valid too and it’s exactly what the private setter does behind the scenes. Making the setter private ensures that the model is read-only. I think it’s just a matter of style.

thanks for commenting.. good to see both approaches.

]]>
By: Dusty http://www.adamflater.net/2007/08/23/binding-with-getters-and-setting/#comment-18 Dusty Thu, 23 Aug 2007 22:38:00 +0000 http://www.adamflater.net/?p=14#comment-18 If you really want the model read only, why are you setting _copyright in the setter?

A more fool-proof way would be to just set _copyrightText in the setData(), then fire off this:
dispatchEvent(new Event(“propertyChange”));

Which tells bindings to update. Get rid of the setter if you really intend for it to be read-only. (personally, I put in log statements that warn that the value is being thrown away)

]]>