Pages

Sunday, February 21, 2010

event.target

I always sees the term "event.target" being used in tons of codes all over the internet, but I never really understand what it is, and what it could actually do, don't even wanna find out.

Until a while ago, when I plan to put the same function for different buttons of the same eventListeners, I realized how convenient it can be.

I have all the buttons inside the same DisplayObject called "mainMap". Then I assigned functions for all of them through: event.target.townI (.desertI, .grassHillI, .volcanoI, etc...), where by "townI" is one of the button in "mainMap".

No comments: