Oh wait that was one version of it... here is the newer one [1] [1] https://github.com/KesslerConsulting/example/blob/master/frameworks/projects/framework/src/mx/core/FlexSprite.as.
-Mark -----Original Message----- From: Kessler CTR Mark J [mailto:mark.kessler....@usmc.mil] Sent: Monday, July 22, 2013 5:48 AM To: dev@flex.apache.org Subject: RE: [jira] [Assigned] (FLEX-33608) Add function "removeAllEventListener()" Yeah, I went down a rabit hole with mine replacing the whole thing and adding some methods to it. But if you check [1] for the working code and you can see an example of it [2]. You don't need to apply it to FlexSprite directly, it was just easy to test tons of components at one time. You can put that overridden code in anything that uses the EventDispatcher. The problem with the whole thing is that the EventDispatcher is not in our control. It's part of flash.events [3]. So what I will do add the code to the issue 33608 and resolve it. Then once I wrap up my new one, I will prob put that in as a separate file to the SDK so that it's available for people to write custom components and use as an EventDispatcher they have control over. The only method I can't seem to complete is the willDispatch method. It can somehow check if it's children will pass it events that could be triggered. [1] https://github.com/KesslerConsulting/example/blob/30ee4b96911d301ea09516324241c4bc9d734f16/frameworks/projects/framework/src/mx/core/FlexSprite.as [2] http://people.apache.org/~mkessler/examples/FLEX-33608/app.swf (also has view source enabled). [3] http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/EventDispatcher.html -Mark -----Original Message----- From: jude [mailto:flexcapaci...@gmail.com] Sent: Sunday, July 21, 2013 10:52 PM To: dev@flex.apache.org Subject: Re: [jira] [Assigned] (FLEX-33608) Add function "removeAllEventListener()" Did you find out if this is possible? I've patched FlexSprite with a remove event listener method but I think that it is causing an issue where my project (web) doesn't load on any computer except my own. But the reason it's not loading might be an issue with monkey patching but I haven't found the cause yet. Also, you can use, nLoopingIndex = [1,2,3].length; for ( ; nLoopingIndex-- ; ) { trace(nLoopingIndex); } to reverse through a loop when you know the index will always be 0 or greater. On Tue, Jul 16, 2013 at 8:16 PM, Mark Kessler <kesslerconsult...@gmail.com>wrote: > Changing the flexsprite wasn't going to get everything. It was just low > hanging fruit for a test/example since it allowed me a wide range of > components to test with. If I could have changed the EventDispatcher it > would have been a better :P > > I like the looping backwards idea for removing items... will keep me from > adjusting values as much. I'll change over to that later. > > I started using more getItemAt because not everything allows the brackets > anymore. Not sure how much of a speed difference there is. > > > Thanks Justin > > -Mark > > On Tue, Jul 16, 2013 at 8:41 PM, Justin Mclean <jus...@classsoftware.com > >wrote: > > > Hi, > > > > > > > > https://github.com/KesslerConsulting/example/commit/30ee4b96911d301ea09516324241c4bc9d734f16 > > > > Very quick glance, but I think that removing items from a list when > you're > > looping to the number of original items in the list can get you into > > trouble. > > for (nLoopingIndex = 0; nLoopingIndex < nListenerTotal; nLoopingIndex++) > > > > It's best to loop backwards to avoid this issue. Like so: > > for (nLoopingIndex = nListenerTotal -1 ; nLoopingIndex >= 0; > > nLoopingIndex--) > > > > I'd also use bracket notation rather than getItemAt but perhaps that's > > just me? > > > > You might also need to think about stage events and the like. > > > > Thanks, > > Justin >