Hello. I have a new blog.

I've moved this blog to the following URL Kerkness.ca. Thank you for visiting, please update your bookmarks.

Saturday, March 1, 2008

Binding in Flex with Getters and Setters

When building a component class and using the recommended method of providing access to properties with getter and setter functions you may find that you are unable to bind to these properties. It's actually rather trivial to enable binding but perhaps not overly obvious. All you need to do is add [Bindable] before the getter function.

 private var _myVar:String;

[Bindable] public function get myVar():String
{
return this._myVar;
}
public function set myVar( value:String ):void
{
this._myVar = value;
}

No comments:

Post a Comment

Thank you for the comments.