[haXe] Method checking

Michael Florentin mflorentin at laerdal.dk
Thu Apr 6 13:54:37 CEST 2006


Michael Hansen wrote:
> It's a feature. MovieClip implements Dynamic, so you can call methods 
> even if they
> are not declared.

I see.  I guess there are good reasons for this design choice...  For 
me, I would love to have the choice of a stricter version of MovieClip 
that didn't implement Dynamic.

After having a look at std/flash/MovieClip.hx, I'm not sure how this can 
be achieved.  My first idea was to change MovieClip.hx:
   extern class StrictMovieClip {
     ...declarations...
   }
   class MovieClip extends StrictMovieClip, implements Dynamic {}
but I'm unsure of the semantics of "extern" and I have a sneaky feeling 
that "implements Dynamic" should go on the extern class declaration to 
achieve whatever dynamic effect is achieved in the original declaration.

My second idea was:
   interface StrictMovieClip {
     ...declarations...
   }
   extern class MovieClip implements StrictMovieClip, implements Dynamic {
     ...declarations...
   }
which also seems much more logical.  But when I subsequently try:
   var movieClip : flash.StrictMovieClip = flash.Lib.current;
I'm informed that "Class not found : flash.StrictMovieClip".  I don't 
see what I'm doing wrong, unless MovieClip.hx has a special magic status 
and I'm not supposed to mess around inside it.


regards...
Michael Florentin




More information about the Haxe mailing list