Error while doing animation in Corona SDK

You know what.  I may be wrong here.  Your interaction may be related to the way you’re using composer.* so strike that last post.

I will take a look.   Just a bit thanks.

I’m sorry again, I hope this simple example can be analyzed and given a solution.

sorry my English.

OK.  I’ve looked  AT THE ORIGINAL POSTED CODE  and I can see that you have some bad behavior, but I don’t know where it is coming from.

Things I noticed:

  • code needs some general cleaning and indenting.  i’d suggest 3 spaces instead of 2.  I’m mentioning this because it is hard to read and thus is hard to debug.
  • You seem to be destroying home when you leave.  If you’re going to do this and if your transition time is 0, there is no reason to use the show() method.
  • You start timers TWICE in show.  i.e. They are NOT in  in a will or did phase check.
  • ‘time’ is a global.  it should be a file-level local declared at the top

Sorry, I could’t figure it out.  This is why I ask for super simple tiny demos.  There is just too much code to penetrate.

My best guess is that you’re staring the timer multiple times and not properly canceling them since you only have the handle to the last timer you started.

Ok, I’ll see if I can debug these timers.

Hi again.

I looked at your newer code.  I cleaned it up a bit and modified it.

Compare what I’m doing to your code.

That Cool! Thanks a lot, although the code changed seems a little complicated (I am a beginner) I was happy that my problem was solved even with a little more code.

I’ll take a look at the modifications to see if I learn!

Thank you very much

Yeah…sorry about that.

I made those changes because your original method had a number of best-practices issues that would have caused no end of problems:

  • globals all over the place (and quite possibly having the same names used in other scenes?)
  • destroying scenes on hide —> did phase (some say “Yes, it is OK.”, Is say “No, it is not.”)
  • ignoring will/did phases in show when setting up timers

  Also, you were using timers and transitions in a sub-optimal way. 

My unified single transition + onComplete listener approach is shorter and safer.  That said, it is more technical, so I understand if it seems confusing at first.