From dcf90a41c28ec4e733dc25d931592ae19378469a Mon Sep 17 00:00:00 2001 From: halfjust Date: Tue, 15 Oct 2013 14:07:46 -0300 Subject: [PATCH] added removeAllMappedEventsforDispatcher() function Added option to remove all mapped events for dispatcher --- .../creativebottle/starlingmvc/events/EventMap.as | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/com/creativebottle/starlingmvc/events/EventMap.as b/src/com/creativebottle/starlingmvc/events/EventMap.as index 032055e..9c2b0e3 100644 --- a/src/com/creativebottle/starlingmvc/events/EventMap.as +++ b/src/com/creativebottle/starlingmvc/events/EventMap.as @@ -61,6 +61,20 @@ package com.creativebottle.starlingmvc.events } } } + + public function removeAllMappedEventsforDispatcher(target:EventDispatcher):void + { + for (var index:int = map.length - 1; index >= 0; index--) + { + var mapping:Object = map[index]; + + if (mapping.target == target) + { + var obj:Object = map.splice(index, 1)[0]; + obj.target.removeEventListener(obj.event, obj.handler); + } + } + } public function removeAllMappedEvents():void {