ActionStep buttons (and thus, Apple's Cocoa buttons) don't dispatch events, and 
they work great. Rather, they use "actions" and "targets". They are perfect for 
most uses, as buttons do not generally have multiple observers.

The basic idea is that the "target" is the observer, and the "action" is the 
method that will be called on target when the button has clicked. So, here's 
some sample code:

public var target:Object;
public var action:String;
public function onMouseDown():Void {
  target[action](this);
}

Pretty simple, handles the most common use of a button and requires very little 
code.

Scott

-----Original Message-----
From:   [EMAIL PROTECTED] on behalf of Manuel Saint-Victor
Sent:   Wed 2/1/2006 1:45 PM
To:     Flashcoders mailing list
Cc:     
Subject:        [Flashcoders] How much size does eventdispatcher add to my 
class?

I'm working on some button classes that I'm trying to make super-small and
would love to have the ability for them to dispatch events.  If I use the
eventDispatcher in my button superclass that they all inherit how much size
would I be looking at added in a compiled file?

Another related question is- would I be better off having my buttons
dispatch a generic click event that would have a property that set the
command such as "shrink", and "grow" and then having the logic in my
event-listening class sort it out with a switch statement or dispatching
events that match the methods already on the eventListener?

Thanks,

Mani
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to