[Resolved] Build 894 odd bug?

I can’t explain this bug, been working on it for hours. It just doesn’t make any sense.

I have an addEventListener for a touch on a 50x50 square. it’s with if event.phase == “ended” then. and when i click on it and release it does that function probably over a thousand times. if not more. it does an insane amount. then if i go and change it so its if event.numTaps == 2 then and make it a tap listener instead of touch, it will work perfectly fine. and that is ALL i am changing. there is no if event.phase == “moved” or anything at all, just an ended one and when I swap to numTaps == 2 it works perfectly fine…anyone else have this problem?

my point being. the touch runs the function thousands of times when its supposed to do it only once, doesnt make sense at ALL. while if i switch to numTaps == 2 it runs it once perfectly, no problems. [import]uid: 77199 topic_id: 31401 reply_id: 331401[/import]

Happy to try to help if you post your code so that we can take a look and try to figure out what might be the cause of the problem.

  • Andrew [import]uid: 109711 topic_id: 31401 reply_id: 125516[/import]

As Andrew said above code would be helpful here; I definitely haven’t encountered this. [import]uid: 52491 topic_id: 31401 reply_id: 125524[/import]

The function itself is about 300 lines, you guys would want to come through your monitor and punch me in the face if I posted it. I figured it out earlier but was just lazy to write it just yet. I didn’t add “return true” at the bottom so what was happening was it was removing the listener, adding a new one and also completing that one and removing that one and adding the old one and completing that one pretty much an insanely long loop in one click. I didn’t expect to have to return true since the touch “ends” and thats when everythings supposed to run, so I figured the listener would add after I release. Anyway that pretty much fixed it. Sorry for posting pointlessly on the bug report when I guess it really wasn’t one. Thanks for trying to help. [import]uid: 77199 topic_id: 31401 reply_id: 125529[/import]

You shouldn’t need to return true unless you are stacking a huge number of objects on top of each other each with a listener tied to the function; if using a loop to spawn or the like I’d check that. Ended phase definitely working fine, tested this AM.

Glad to hear it is resolved either way, marking as such :slight_smile: [import]uid: 52491 topic_id: 31401 reply_id: 125646[/import]

Happy to try to help if you post your code so that we can take a look and try to figure out what might be the cause of the problem.

  • Andrew [import]uid: 109711 topic_id: 31401 reply_id: 125516[/import]

As Andrew said above code would be helpful here; I definitely haven’t encountered this. [import]uid: 52491 topic_id: 31401 reply_id: 125524[/import]

The function itself is about 300 lines, you guys would want to come through your monitor and punch me in the face if I posted it. I figured it out earlier but was just lazy to write it just yet. I didn’t add “return true” at the bottom so what was happening was it was removing the listener, adding a new one and also completing that one and removing that one and adding the old one and completing that one pretty much an insanely long loop in one click. I didn’t expect to have to return true since the touch “ends” and thats when everythings supposed to run, so I figured the listener would add after I release. Anyway that pretty much fixed it. Sorry for posting pointlessly on the bug report when I guess it really wasn’t one. Thanks for trying to help. [import]uid: 77199 topic_id: 31401 reply_id: 125529[/import]

You shouldn’t need to return true unless you are stacking a huge number of objects on top of each other each with a listener tied to the function; if using a loop to spawn or the like I’d check that. Ended phase definitely working fine, tested this AM.

Glad to hear it is resolved either way, marking as such :slight_smile: [import]uid: 52491 topic_id: 31401 reply_id: 125646[/import]