Another sideeffect is this: If your class extends a class with
bindable properties and it tries to implement IEventDispatcher it has
to use override allthough you can't see the eventDispatcher methods.
Our solution was to let the baseclass extend EventDispatcher.
Cheers
Ralf
(Only two more days before going home :))
On Nov 15, 2007 5:10 PM, Peter Hall <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
> [Bindable] actually makes a number of changes to your code. If your
> class doesn't already implement IEventDispatcher, then it adds that
> with methods to implement the interface which delegate to an instance
> of EventDispatcher. For every bindable property, where you don't
> specify the change event, it will add dispatchEvent() calls inside
> setters. And, if it's just a var, it will convert it to a get/set
> pair, with the dispatchEvent inserted.
>
> Another side effect is that the following is also legal:
>
> interface IA {
> function get b():Boolean;
> function set b(bool:Boolean):void;
> }
> class A implements IA {
> [Bindable]
> public var b:Boolean; // [Bindable] converts this to a get/set pair
> }
>
> But, it is not legal without the metadata.
>
> Peter
>
>
> On Nov 15, 2007 5:58 AM, Stephen Allison <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> >
>
> > 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
> >
>
--
Ralf Bokelberg <[EMAIL PROTECTED]>
Flex & Flash Consultant based in Cologne/Germany
Phone +49 (0) 221 530 15 35