Degrafa vs. FXG (and Spark) [Bindable]
I've noticed that FXG, and Spark in general, has very few [Bindable] properties, while in Degrafa, almost every property is [Bindable], some of the classes event have class [Bindable] tags. I am taking advantage of this greatly.
Are you guys planning on making more of the properties [Bindable]? Or does the compiler auto-generate custom [Bindable] events in the background (that would be very nice)?
A reasonable compromise would be to have each property dispatch a custom "myNameChange" event, only if "target.hasEventListener('myNameChange')". Otherwise this forces us into a position where, to bind to the properties, we have to extend every class and add that functionality.
For instance, I would like to know when the "layout" changed on a skinnable container, and when "clipAndEnableScrolling" changes, but they're not [Bindable] like most of the other properties in there.
To prevent a performance hit, you could just do something like Degrafa does, with custom events:
[Bindable(event="myPropertyChange")]
public function get myProperty():String
{
return _myProperty
}
public function set myProperty(value:String):void
{
if (_myProperty != value)
{
var oldValue:String = _myProperty;
_myProperty = value;
dispatchPropertyChangeEvent("myProperty", "myPropertyChange", oldValue, value);
}
}
protected function dispatchPropertyChangeEvent(property:String, eventType:String, oldValue:*, newValue:*):void {
if (hasEventListener(eventType))
dispatchEvent(new Event(eventType)) // or PropertyChangeEvent....
}
//////////
If Flex did this in the background for properties not marked [Bindable], that would be EXTREMELY helpful, and I don't think it would change/break anything. I feel like this is already the case...
Let me know what you think.
Lance
