Oh snap! I learn something new everyday. Thanks for that tidbit. I just looked up that function and it's actually a static function on UIComponent, so you only get to set that once (ie you can't have one function to catch events for one type of component and another to catch a different component's events). Interesting stuff.
Doug On Wed, Jul 16, 2008 at 9:10 PM, reflexactions <[EMAIL PROTECTED]> wrote: > Well you can at least catch all events dispatched on a particular > component, and without subclassing or patching. > > You assign a callback function to the dispatchEventHook property. > It takes two params the event and the target and is called > immediately prior to the actual dispatch. > > --- In flexcoders@yahoogroups.com, "Josh McDonald" <[EMAIL PROTECTED]> wrote: >> >> Thanks Doug, I figured that'd be the answer. Not against monkey > patching by >> any means (we use a few atm to fix bugs in SOAP code), just wanted > to check >> first to see if there was a secret way to do it that I didn't know > about >> before I go and mess about with FlexSprite :) >> >> -Josh >> >> On Thu, Jul 17, 2008 at 1:41 PM, Doug McCune <[EMAIL PROTECTED]> wrote: >> >> > Is this your custom component or just any component you don't > control? >> > If it's yours you could override dispatchEvent to know whenever > the >> > component dispatches any event. Or you could override > addEventListener >> > to know whenever something adds an event listener. >> > >> > If it's not your custom component (ie you can't override anything) >> > then you might be out of luck (other than going through and > manually >> > adding listeners for all possible strings you think the component >> > might dispatch). But I don't think there is any way to know all > the >> > events that a component might dispatch in its lifetime. ALthough > you >> > could probably do a search on the FLex SDK for "dispatchEvent(" > and >> > compile a full list of all events that all Flex SDK components > will >> > ever dispatch. I wonder how long that list is... >> > >> > The other thing to try (although this probably violates > your "without >> > hacking" clause) is this monkey patched version of FlexSprite I >> > blogged about: >> > http://dougmccune.com/blog/2008/02/21/monkey-patching-flexsprite- > to-list-all-event-listeners-on-any-flex-component/ >> > >> > What that does is gives you an array of all the event listeners > that >> > have been registered on a certain component. That's not the same > as a >> > list of all events that the component might ever dispatch (since > the >> > component may very well dispatch events that nobody listens to). > The >> > other thing I would suggest is you could use the same approach to >> > monkey patch FlexSprite and add some special code into the > override >> > for dispatchEvent and then you could be notified about anytime the >> > component dispatches any event at all. Again, that probably goes >> > against the not hacking condition of the question :) >> > >> > Doug >> > >> > On Wed, Jul 16, 2008 at 8:11 PM, Josh McDonald <[EMAIL PROTECTED]> wrote: >> > > Hey guys, >> > > >> > > Is it possible to listen to all events that bubble to / are > dispatched >> > from >> > > a certain component? >> > > >> > > Don't worry, I don't actually plan on using this in any actual > code! I'm >> > > just interested in doing some extremely verbose logging to > gather >> > > information for a blog post I have in mind ;-) >> > > >> > > -Josh >> > > >> > > -- >> > > "Therefore, send not to know For whom the bell tolls. It tolls > for thee." >> > > >> > > :: Josh 'G-Funk' McDonald >> > > :: 0437 221 380 :: [EMAIL PROTECTED] >> > > >> > >> > ------------------------------------ >> > >> > -- >> > Flexcoders Mailing List >> > FAQ: > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt >> > Search Archives: >> > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! > Groups >> > Links >> > >> > >> > >> > >> >> >> -- >> "Therefore, send not to know For whom the bell tolls. It tolls for > thee." >> >> :: Josh 'G-Funk' McDonald >> :: 0437 221 380 :: [EMAIL PROTECTED] >> > >