Hello,
What is going on that makes this legal code:
[Bindbale]
class MyClass {
function something() {
dispatchEvent(new Event('someevent'));
}
}
What is curious is that I can call dispatchEvent since the class doesn't
define such a method, nor does it extend EventDispatcher. Remove the
[Bindable] tag and the above will not compile. So, the [Bindable] tag seems
to be causing the class to implicitly implement IEventDispatcher somehow.
This is not normally a problem, but if you need to refer to this class in a
Flash component kit component then Flash will complain as it doesn't know
that anything with a [Bindable] tag can dispatch events. So, what exactly
is going on behind the scenes? From my exploration of the AS generated by
mxmlc I thought that the compiler would not do anything to classes such as
the one above, and instead set up a series of changewatchers to implement
bindings to objects of this class, this being the case then I would not
expect classes that don't explicitely extend EventDispatcher or implement
IEventDispatcher to be capable of being treated as if they do. I appreciate
that [Bindable] classes, and those with [Bindable] properties need to be
able to dispatch events, but am curious about the exact means by which this
is achieved.
Any insight much appreciated!
Stephen