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

event recursion when destroy() function is fired #7

Open
AnarchyAcres opened this issue Feb 3, 2014 · 0 comments
Open

event recursion when destroy() function is fired #7

AnarchyAcres opened this issue Feb 3, 2014 · 0 comments

Comments

@AnarchyAcres
Copy link

Thank for the great class. I am unable to remove the scrolling list from the stage without generating an event recursion error in the TouchListItemRenderer destroy() function. The error is thrown when the textfield is removed from the list.

I fixed the issue by changing the listener for the destroy() function. As written, the TouchListItemRenderer class listens for the EVENT.REMOVE event. This event bubbles into children like the textfield, so that the remove event fires once for the list item and again for any children of the list item, generating the error.

I changed this

public function TouchListItemRenderer(){
addEventListener(Event.REMOVED, destroy);
}

to this:

public function TouchListItemRenderer() {
addEventListener(Event.REMOVED_FROM_STAGE, destroy);
}

and made the error and problem go away. It's not trivial in that events floating around after their object has been removed can and do cause problems in apps.

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

1 participant