mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge pull request #414 from PrettySimple/patch-2
[as3] Fix strange behaviour of listeners
This commit is contained in:
commit
16489aaf58
@ -43,13 +43,17 @@ package spine.animation {
|
|||||||
public function add (listener:Function) : void {
|
public function add (listener:Function) : void {
|
||||||
if (listener == null)
|
if (listener == null)
|
||||||
throw new ArgumentError("listener cannot be 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 {
|
public function remove (listener:Function) : void {
|
||||||
if (listener == null)
|
if (listener == null)
|
||||||
throw new ArgumentError("listener cannot be 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 {
|
public function invoke (... args:*) : void {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user