Merge pull request #414 from PrettySimple/patch-2

[as3] Fix strange behaviour of listeners
This commit is contained in:
Mario Zechner 2016-07-18 16:30:24 +02:00 committed by GitHub
commit 16489aaf58

View File

@ -43,13 +43,17 @@ package spine.animation {
public function add (listener:Function) : void {
if (listener == null)
throw new ArgumentError("listener cannot be null.");
_listeners[_listeners.length] = listener;
var indexOf:int = _listeners.indexOf(listener);
if (indexOf == -1)
_listeners[_listeners.length] = listener;
}
public function remove (listener:Function) : void {
if (listener == null)
throw new ArgumentError("listener cannot be null.");
_listeners.splice(_listeners.indexOf(listener), 1);
var indexOf:int = _listeners.indexOf(listener);
if (indexOf != -1)
_listeners.splice(_listeners.indexOf(listener), 1);
}
public function invoke (... args:*) : void {