Page 1 of 1

move without waiting makes obj jump to new location|SOLVED

Posted: Thu Jul 31, 2014 1:36 pm
by Johan_VH
Hi again,

another problem: I have a multiplechoice-quiz. When the user selects an answer a group moves into view detailing wheter he or she answered correctly. This group slides into view from the bottom of the screen.

It works fine if I just move it, but then you notice that the clock which has to start counting down only starts after the move is completed. So, add the 'without waiting' to the code. Right? Unfortunately, the group doesn't display until after it has reached it's location, so it just jumps on screen after the 20 ticks it should have taken to slide on... and the clock only starts after the group is visible.

Code: Select all

move  group "correct_grp" from 512,1100 to 512,384 in 20 ticks
animation, but of course the rest of the handler waits

Code: Select all

move  group "correct_grp" from 512,1100 to 512,384 in 20 ticks without waiting
the group jumps into view after 20 ticks and even then the rest of the handler is executed after it appears

Anyone?

Re: move without waiting makes object jump to new location

Posted: Thu Jul 31, 2014 1:48 pm
by Dixie
Have a look at 'lockMoves' in the dictionary...

Re: move without waiting makes object jump to new location

Posted: Thu Jul 31, 2014 1:53 pm
by dunbarx
No idea how you made your project, but try this and see where your methods differ. You will need two buttons and a field. In the script of btn 2:

Code: Select all

on mouseUp
   put 0 into fld 1
   moveĀ  btn 1 from 212,500 to 212,100 in 50 ticks without waiting
     startClock 
end mouseUp

on  startclock
   add 1 to fld 1
   if the loc of btn 1 = "212,100" then exit to top
   send "startclock" to me in 2
end startclock
You are spot on with the use of "without waiting", as far as that goes. Is there a clue in the difference in our methods?

Craig Newman

Re: move without waiting makes object jump to new location

Posted: Fri Aug 01, 2014 3:41 pm
by Johan_VH
I tried your code Dunbarx, and it worked like a charm. I used a new card to test this.
So then I copied it all to the offending card, aaaaaaand it didn't work anymore. In the meantime I was working on another issue: this particular card had a lag of 3 seconds when being called.

So I decided the problem would lie somewhere else, and didn't have anything to do with the 'without waiting'. Eventually it turned out that the culprit was a quicktimemovie I used to display a countdown-clock. Now that I have replaced it with a jpg that I change every second with the 'filename' command, everything works. No lag displaying the card, and no more jumping to positions when I use the 'without waiting'.

Strange but true, there's something fishy with the player using quicktime apparantely...

Thanks for your help!

Johan