transition.to onComplete out of sync

Hi all,

if you take my example code of TableView already posted in the forum here: http://developer.anscamobile.com/forum/2010/05/23/tableviewlib-sample-entire-lua-still-under-construction and you run it, you will see a little strange behavior of scrollline at left side of tableView. This behavior correspond to the ability to modify alpha value of this object once transition.to (the scrolling) is completed. But, you will notice that a call to hideLine is performed even when scrolling (it means transition.to still running, not completed), so alpha is modified before line stops.

I suposed that onCompleted=hideLine() in my transition.to call, should call a hideLine once transition is already completed, i.e. scrolling finished, but it doesn’t occur in that way. So, I would like to know if there is a bug related to this or if there is something missing in my code.

Regards,

Flavio. [import]uid: 3022 topic_id: 1049 reply_id: 301049[/import]

Mmmh, ran your code. Placed a print command in the scroll function and hideline function. And it always appeared in pairs. Can#t see what you mentioned. [import]uid: 5712 topic_id: 1049 reply_id: 2573[/import]

Mike,

The problem is evident when you roll the list after touching. During touching, let say “dragging” (keeping your finger in touch) it works fine, but if you roll the list quickly and let your finger out, you’ll notice that list continue scrolling but the line disappear because of onComplete=hideLine() calls is performed, even when transition still running, which causes a call before scrolling stop.

hideLine should be called once transition.to of the scrollLine is finished, not before. But that’s not working in that way, which means onCompleted calls is called when transition is not yet completed, that’s the error.

Regards,

Flavio. [import]uid: 3022 topic_id: 1049 reply_id: 2575[/import]

In addition, a second problem appear with transition.cancel function.

To reproduce the error, try to roll very fast the list in one direction, let’s say up, immediately, roll the list down in other velocity, more slow. You will see that at the list goes up after first roll, then it goes down because of second roll, but when second roll which is slow stops, as the first transition.to event still working, the list return its way to go up, even when the source code calls transition.cancel to stop previous movements!

So, here we can see 2 errors with transitions:

  • 1st onCompleted is called no matter if transition is finished (completed) or not, it calls the function anyway.
  • 2nd transition.cancel doesn’t stop active transition, as they still running. So I can’t stop them in any way.

I am running with SDK 2.0 beta 3, and the same behavior is produced in early versions.

I hope Ansca staff fix those problems quickly.

Regards,

Flavio [import]uid: 3022 topic_id: 1049 reply_id: 2576[/import]

Remove the ( ) from the onComplete property

[lua]scrollLine.scroll=transition.to(scrollLine,{y=destline,time=velocity*10,transition=easing.outExpo,onComplete=hideLine()})[/lua]

That show fix it. [import]uid: 5712 topic_id: 1049 reply_id: 2577[/import]

Mike,

Thanks for your help, that solve my onComplete call, now it works as expected.

Flavio. [import]uid: 3022 topic_id: 1049 reply_id: 2611[/import]

Are there still problems here?

There was a new issue in Beta 3 with removeEventListener in certain contexts, but we believe all this was fixed in Beta 4. [import]uid: 3007 topic_id: 1049 reply_id: 2631[/import]