1 Reply Latest reply on Sep 10, 2009 11:22 PM by msakrejda

    extends EventDispatcher


      Hello everyone ,

        I am using FB3.  The autocomplete is nice.  However , when I go to create a class that extends EventDispatcher , sometimes the autocomplete will do this.


          import flash.events.EventDispatcher;

          import flash.events.IEventDispatcher;


          public class FilesTileList extends EventDispatcher
              public function FilesTileList(target:IEventDispatcher=null)


      Why is it doing this ? And who on earth would want to implement an interface when extending works just fine.  Smackdown for previous statement in 3 . 2 . 1 ...

        • 1. Re: extends EventDispatcher
          msakrejda Level 4

          I assume you checked "implement constructors from superclass"? If so, what's the problem? It's creating a constructor that takes the same parameters as an EventDispatcher.The target is another IEventDispatcher that the EventDispatcher can wrap (more or less):



          target:IEventDispatcher (default = null) — The target object for events dispatched to the EventDispatcher object.   This parameter is used when the EventDispatcher instance is aggregated by a class that implements IEventDispatcher; it is necessary so that the containing object can be the target for events. Do not use this parameter in simple cases in which a class extends EventDispatcher.


          This is optional, so you can delete this autogenerated constructor if you'd like and stick with the default constructor (or simply uncheck the 'generate constructor' box).


          And the main reason for not extending EventDispatcher is when you're already extending something else. In the name of sanity (okay, this is a biased view), ActionScript chose to omit multiple inheritance from the language.