Re: [flexcoders] Is it possible to listen to *all* events without hacking the SDK?
Add an event listener to the system manager. Every event tat bubbles will hit the system manager. On Jul 16, 2008, at 11:11 PM, Josh McDonald 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] Is it possible to listen to *all* events without hacking the SDK?
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]
Re: [flexcoders] Is it possible to listen to *all* events without hacking the SDK?
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]
Re: [flexcoders] Is it possible to listen to *all* events without hacking the SDK?
Hii Josh, I have no idea, if it is exactly related to your query. I was looking for the same sort of solution to do an AuditLogger stuff. I want event based logging. No traces and all. It was like: 1. capture all the events 2. get their Target and currentTarget 3. log with timestamp and much more. The only place, I could think of is Application itself. Put your listener at application, capture all the events there and log. But it has a few drawbacks: even the mouseMove will give you a lodz of entries and then child components and the underlying parents of it. So, it's still pending on my list to get a best solution out of it. Am curious to see expert thoughts here. Thanks, Manu. Josh McDonald-4 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] -- View this message in context: http://www.nabble.com/Is-it-possible-to-listen-to-*all*-events-without-hacking-the-SDK--tp18500774p18501011.html Sent from the FlexCoders mailing list archive at Nabble.com.
Re: [flexcoders] Is it possible to listen to *all* events without hacking the SDK?
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]