Another way to do it is to send much more messages, and use the milliseconds to time execution of the code. You will run into problems if your code takes longer to run then the alotted 700 milliseconds tho. As with all methods, this only gives somewhat of a precision, but no true precision can ever be achieved.
on mouseUp
send "doStuff" && the milliseconds to me in 70 milliseconds --fires 10 times too much
end mouseUp
on doStuff prevTime
if the milliseconds - prevTime >= 700 then
put the milliseconds into nextTime
--do stuff here
else
put prevTime into nextTime
end if
send "doStuff" && nextTime to me in 70 milliseconds
end doStuff
Exact timing
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Exact timing
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: Exact timing
Okay,
It looks like there are several good (though lengthy) ways of doing it.
BTW, I just got 5.5, so now I can open your stacks. I also got Android, so I'll be in the Android Dev section mostly now.
You can see by the code and samples here that everyone does things a little differently. Funny how it's so much easier to read your own code, isn't it?
Thanks everyone for your answers and test stacks...Gotta love Livecode.
Dave
It looks like there are several good (though lengthy) ways of doing it.
BTW, I just got 5.5, so now I can open your stacks. I also got Android, so I'll be in the Android Dev section mostly now.
You can see by the code and samples here that everyone does things a little differently. Funny how it's so much easier to read your own code, isn't it?
Thanks everyone for your answers and test stacks...Gotta love Livecode.
Dave