Hi Michael,
  I think this is down to a difference in programming style. We don't
use events in quite the same way - or rather, for _most_ situations,
we use events in exactly the way that you describe.

 However, there are many situations where defining event types,
listeners and dispatchers is (I find) much too heavyweight.
Specifically, in instances where there is only going to be one single
create-doprocess-callback sequence and nothing else will ever get
involved in the chain.

 Additionally, you can use the Callback method I describe to tack
additional arguments on to handlers called in response to event
objects created internally by Adobe code - which are instances in
which you couldn't extend the relevant Event object.

 (This difference in approach may be because we're leaping into AS3
straight from Flash/AS2 rather than going via Flex.)

Cheers,
 Ian

On 4/9/07, T. Michael Keesey <[EMAIL PROTECTED]> wrote:
The problem with using proxies is that you circumvent compile-time
checking. I find that there are better ways of dealing with such
situations. Three suggestions:

1) In the handler function, look for a property of the event target.
This works for most cases where you need a handler function to react
differently in a given situation. (For example, different buttons
could carry an "index" event that the handler looks for via
MyButtonClass(event.target).index.)

2) Differentiate the event type and have one handler deal with several
event types. This is not useful in cases where you may have an
unlimited number of different responses, and generally I wouldn't
recommend this as a solution, but there may be some cases where it's
appropriate.

3) Create a new subclass of Event with one or more extra properties.
(For example, IndexEvent, with an added property, "index".)

By the way, I think the AS3 syntax for this:

> button.onRelease=myFunction;  // AS3

... is actually:

button.addEventListener(MouseEvent.CLICK, myFunction);



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to