F[MX] listeners

i was recently working on a project for my new flash site and was pearing into some scripts at www.flashkit.com and i saw this odd one that have never seen before. what’s a listener?


They have come up with the new even model of Flash MX. Basically, they “listen” for events. I don’t know, for instance, if you want the _root to do something onKeyDown, well, it won’t work if you just put _root.onKeyDown=function(){…} because the _root doesn’t listen to the Key messages by default. Therefore you have to register it as a key listener like so:


and then you can do whatever you want.

There’s a very good article in the www.ultrashock.com tutorials section by Robert Penner, and one too called Flash MX event model at www.actionscript.org but not quite as good by Guy Watson (he loves metaphors…:P).

pom :cowboy: