I believe it can be extended but I haven’t tried it recently and none of the Flex classes ended up extending, all faceless classes still mixed it into the prototype.  This system is changing in 2.0.

 

Matt

 


From: [email protected] [mailto:[email protected]] On Behalf Of Joe Berkovitz
Sent: Tuesday, May 03, 2005 2:04 PM
To: [email protected]
Subject: Re: [flexcoders] dispatchEvent in AS class?

 

I understand that it's a mixin, and how to mix it in, but I seem to
remember Matt C. telling me that it could also just be directly extended.

I'll probably just take the conservative route and mix it in.

JesterXL wrote:
> It's a mixin, not a Class which you can extend.  It uses the Decorator
> pattern to dynamically add methods at runtime, that's why you have to define
> the methods up top so the compiler doesn't whine:
>
> public var addEventListener:Function;
> etc.
>
> I'm sure in the future, since the Flex team considers prototype a bad word,
> you'll be able to inherit, but for now, it's "attached".
>
> ----- Original Message -----
> From: "Joe Berkovitz" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Tuesday, May 03, 2005 11:01 AM
> Subject: Re: [flexcoders] dispatchEvent in AS class?
>
>
> BTW, any reason not to simply extend EventDispatcher itself, if this
> class does not already extend some other superclass?
>
> JesterXL wrote:
>
>>Nope, after my 2nd cup of coffee I understand, didn't know it was a
>>Singleton, doh!  :: hits self on head ::
>>
>>----- Original Message -----
>>From: "Erik Westra" <[EMAIL PROTECTED]>
>>To: <[email protected]>
>>Sent: Tuesday, May 03, 2005 10:49 AM
>>Subject: RE: [flexcoders] dispatchEvent in AS class?
>>
>>
>>Hmm, I think u are missing the point that this class is a singleton and
>>thus only instantiated once.
>>
>>The constructor is private and the instance can only be retrieved via
>>the getInstance method:
>>
>>static public function getInstance():SocketManager
>>{
>>if (!_instance)
>>{
>>_instance = new SocketManager();
>>};
>>return _instance;
>>}
>>
>>This method checks if the instance is created. If it is it simply
>>returns the instance, making sure only instance of this class exists.
>>
>>If im missing something here, please point me to it :)
>>
>>
>>Greetz Erik
>>
>>-----Original Message-----
>>From: [email protected] [mailto:[email protected]] On
>>Behalf Of JesterXL
>>Sent: dinsdag 3 mei 2005 16:43
>>To: [email protected]
>>Subject: Re: [flexcoders] dispatchEvent in AS class?
>>
>>Doing this:
>>
>>EventDispatcher.initialize(this);
>>
>>Puts the addEventListener, removeEventListener, and dispatchEvent
>>functions as well as the arrays to hold the events on each instance of
>>the class.
>>Additionally, that method is run each time a class instance is
>>instatiated, doing the redudant re-initializing again.
>>
>>The reason I mentioned do it this way:
>>
>>static var mixIt = EventDispatcher.initalize(SocketManager.prototype);
>>
>>Is because by being static, it is only initialized once, not per each
>>class instantiation, and secondly, the methods are added to the class
>>once, thus using significantly less RAM.
>>
>>So, it is necessarey if you want a more efficient class.
>>
>>
>>----- Original Message -----
>>From: "Erik Westra" <[EMAIL PROTECTED]>
>>To: <[email protected]>
>>Sent: Tuesday, May 03, 2005 7:18 AM
>>Subject: RE: [flexcoders] dispatchEvent in AS class?
>>
>>
>>
>>
>>
>>
>>>static var mixIt = EventDispatcher.initalize(SocketManager.prototype);
>>
>>That is at all not nescessary
>>
>>
>>
>>
>>Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>Yahoo! Groups Links
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>

> Yahoo! Groups Links
>
>
>

>
>
>
>
>




Yahoo! Groups Links

Reply via email to