Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy-paste error? #29

Open
sunnyawake opened this issue May 2, 2014 · 3 comments
Open

copy-paste error? #29

sunnyawake opened this issue May 2, 2014 · 3 comments

Comments

@sunnyawake
Copy link

in SPDisplayObject.removeEventListenerForType:

if ([eventType isEqualToString:SPEventTypeEnterFrame] &&
   ![self hasEventListenerForType:SPEventTypeEnterFrame])
@PrimaryFeather
Copy link

What exactly is the problem? I still can't spot it g.

What this code does is executing the if-clause only the first time you're adding an enter-frame listener. That's for an optimization: a list of objects that the "enterFrame" event is sent to (instead of having to iterate over the complete display tree).

@sunnyawake
Copy link
Author

it's in the removeEventListener() method, but has a "!" ?

@PrimaryFeather
Copy link

Yeah, but that's fine! Note that in the line above that one, "super removeEventListeners..." is called. So the listener was already removed. The "if" now checks if there is another enter frame listener remaining; if not, that object can be removed from the list.

See what I mean?

PrimaryFeather pushed a commit that referenced this issue Aug 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants