in a script started on “Position Changed” event.. how to do some actions when the position isn’t changing anymore ?
in a script started on “Position Changed” event.. how to do some actions when the position isn’t changing anymore ?
]]>
« To try out the new Version, I run this line: (Previous Post)
< ![CDATA[
using a timer
see setTimeout
]]>
< ![CDATA[
but it doesn’t know when the touch input will end…. we can’t hard code a duration
]]>
< ![CDATA[
we can. i did
]]>
< ![CDATA[
You are not helping me…. how?
]]>
< ![CDATA[
Have a look at this. I wrote that some time ago.
var e=LL.getEvent();
var c=e.getContainer();
var sessiontoken;
do{
sessiontoken=Math.random();
}while(TOKEN!==”undefined”&&sessiontoken===TOKEN);
TOKEN=sessiontoken;
setTimeout(f,50);
function f()
{
if(TOKEN===sessiontoken)
{
//do something when events finished
}
]]>
< ![CDATA[
Thanks, can you do a pastebin, because here the indentation are… **_**
]]>
< ![CDATA[
I just simplified it now…
If you want indentation either use my Autoformat tool or do it manually, because I don’t use it.
]]>
< ![CDATA[
By the way, clearTimeout is finally available, it will help the implementation of this kind of stuff.
]]>
< ![CDATA[
Don’t know how, but thanks ^^
]]>
< ![CDATA[
The idea is to set a timeout on each position change event, and clear it on next event. This way (not tested):
if(id in self) clearTimeout(id);
id = setTimeout(do_something, 200);
]]>
< ![CDATA[
aaah ok,thanks !
]]>