Simulator and Device Crash on Drag event

Hello,

I’m using a drag event that is basically the same as the one in the Sample Code. My problem is, if a user still has their finger on a draggable object when time runs out, the app crashes as soon as director tries to change the scene. I’ve tried a bunch of different things, but I can’t figure out how to get the app not to crash. Any suggestions would be appreciated.

Thank you [import]uid: 47722 topic_id: 20838 reply_id: 320838[/import]

It’s hard to say without seeing code; is the listener on the object a touch listener? (Some people use Runtime for dragging which would be an issue here.) [import]uid: 52491 topic_id: 20838 reply_id: 82140[/import]

Hi Peach,

My touch listeners are all object based. Do I need to remove them?

Example:

apple:addEventListener(“touch”, startDrag)

Thank you. [import]uid: 47722 topic_id: 20838 reply_id: 82212[/import]

No, you shouldn’t need to remove them; this may be a post for the Director sub forum though. (I have experience with it but third party class issues are generally handled by their creators.)

That said if you could provide a sample I, or someone else in the community, may be able to assist you. (I understand you may not wish to do this.)

Peach [import]uid: 52491 topic_id: 20838 reply_id: 82234[/import]

I would post my code, but I really don’t think it is the problem anymore. Today, I narrowed down the problem even further. I was using Director 1.4 and the problem was occurring. Guided by Peach’s advice that it could be a Director problem (thanks Peach), I decided to download Director 1.3 and try that…no luck. I then tried Director 1.2 and the problem is gone and that’s great! However, my app uses the scene reload feature and pop up feature introduced in version 1.3 and above. So I guess I’ll have to lose something to gain something…oh well.

Two more little questions

  1. Does the Storyboard API have a Pop-up feature? (because I’ll attempt to switch to it if it does)
  2. How do I report this as a bug to the creator of Director class

Thanks Peach for your great help and advice. Your tutorials on Techority have helped me a lot and I really appreciate what you do for us developers. [import]uid: 47722 topic_id: 20838 reply_id: 82359[/import]

Hey again,

I’m glad you’ve narrowed it down - I actually still use Director 1.2 myself.

For popups you can code them manually, it honestly isn’t that hard - I had to do it recently for a client and it just involved a button that added all the popup items and put them in a group, then clearing the group when it was closed.

For the scene reset there are also workarounds; one is to change to another scene, eg, “level1reset.lua” and in there have it go back to level1 after 1 millisecond. (just a suggestion.)

I am unsure if your issue was a bug or not but it may be worth posting about it in the Director sub forum just to notify the creator of any potential issues, yes.

No worries for the help/advice and thanks very much for those kind words :slight_smile:

Peach [import]uid: 52491 topic_id: 20838 reply_id: 82419[/import]

Ok, so here’s something even more awesome! I found an old forum posting from last March that led to a file on Jonathan Beebe’s blog. The file is called cleanGroup.lua and it is way better than the cleanGroups() function from within Director. It avoids memory leaks and removes event listeners from all objects before cleaning a group. Once I implemented this, I was able to use Director 1.4 and not have my device nor the simulator crash. I couldn’t ask for a more perfect solution. I have posted the link to the module below. Thanks again Peach for the advice (and Jonathan Beebe for the module).

http://jonbeebe.tumblr.com/post/3760389212/proper-group-cleaning-in-corona-script-download [import]uid: 47722 topic_id: 20838 reply_id: 82623[/import]