gskinner.com: gBlog: FlashMX 2004 source code, news, reviews and opinions
Back to gBlog Main gskinner.com website: source code, portfolio, etc. contact Grant Skinner

Syndication
RSS 1.0
RSS 2.0


Subscribe
Enter your email address to be notified when posts are added.

Search

Resources
Conference Session Notes

Flash Blogs
Waxpraxis
Philterblog
W3Blog
Jonas Galvez
Josh Dura
Quasimondo
Flashguru
Sean Voisen
Colin Moock
Flazoom
Greg Burch
Pope De Flash
Peter Hall
Glyn Thomas
actionscript.com
Princess Pegg


Aggregators
Flog
FullAsAGoog
MXNA
Hall of Justhese


« OOP4AS2#6: Private members | Back to Main | [code] GDispatcher: Event swiss army knife. »

September 25, 2003


IMPORTANT NOTE: This is an old archive. It is only here to support outdated external links. To view the updated version of this archive, please go to the blog index, and search for the title of this document using the search form.

Event dispatcher, the next morning
Posted by Grant

Ok, I have to post a bit of a retraction. While EventDispatcher is still a big improvement over previous event models, it's not quite as cool as I thought it was at 3am last night. Nothing ever looks quite as hot the morning after, does it?

The ability to subscribe functions or methods to events is made vastly less useful than I excitedly thought last night by the fact that the function will, of course, be executed within the scope of the object dispatching the event (duh). This means that really, this approach is only about as useful as a callback event handler (the functionality is virtually identical) - its occasionally handy for quick'n'dirty prototyping, but usually not good form.

Ahh... the murky clarity of 3am experimentation. Oh well, stay tuned, I hope to build out an extended version of the eventDispatcher that includes some nifty new tricks.

Posted @ 10:13 AM by Grant | TrackBack


Comments

check your previous blog entry on this subject. I posted what I wrote a while back. its the eventdispatcher, plus it allows you to define the object and method you wish to call if you want. it also lets you pass args (despite being less OOP in this manner)

Posted by: Kenny Bunch at September 25, 2003 10:23 AM

Have you taken a look at Mach-II which morphed as an 'OO' framework from Fusebox? I do realize at this point most samples etc on written for CFMX.

Posted by: Mike Brunt at September 25, 2003 10:58 AM

ahh, morning Afters..:p

Posted by: Funkatron at September 25, 2003 11:57 AM

I think it's great because you can call public methods on the dispatcher from another object without explicitly calling the object. Does it break OO if you do this from a view that knows nothing of a model? Even if it does I think this functionality is great. AsBroadcaster couldn't do it.

Posted by: Mike Britton at September 28, 2003 11:11 AM

How about using delegates?
I assume the use of delegates so I simply extended eventDispatcher to take two forms of addlistener, one with a delegate and the original form uses arguments.callee and builds a delegate on the fly. - most times, the target object is the same one adding a listener.

Posted by: rasheed at November 21, 2004 07:36 PM

Hosting by NetKeepers.ca | Powered by Movable Type 2.661
The text content of this blog is licensed under a Creative Commons License. Graphics are ©2003 Grant Skinner.