I made my own tweening library (I know about GTween, but I made it a long ago).
It have been working so far, but in one particular place it started to misbehave...
I went to investigate, and found out it is buggy, quite buggy, the fact it has been working so far is just... magic (no better word O.o)
Right now when I create a tween, the function creates a tween table, add a enterframe event listener to a sprite (that is a argument of the tweening function) and points to that tween parameters table.
When the tween gets removed, I do the opposite:
tween.sprite:removeEventListener(Event.ENTER_FRAME, tweenUpdate, tween.sprite);
I think this is wrong, because it is not working, my issue that is presented is that after I delete a tween, it keeps working... in this particular case it is a alpha value, the tween was supposed to set the alpha from 1 to 0 over 5 seconds, then stop.
It works, except after those 5 seconds when I click the object again, it goes from 1 to 0 again, but really quickily (I guess that about 2 or 3 frames).
I am thinking the tween is not gone...
So, is my code to remove the event listener wrong? prints assure me the line with the removeEventListener ran, but the tween does not stop (as soon as I set the alpha to 1, it tweens to 0 again, without me telling it to again).