function onKeyEvent(key as String, press as Boolean) as Boolean
handled = false
if press then
if(key = "down")
//do something
end if
//and again if pressed, do something
end if
return handled
end function
function onKeyEvent(key as String, press as Boolean) as Boolean
handled = false
if press then
if m.key_cnt = invalid then m.key_cnt = {}
if m.key_cnt[key] = invalid then m.key_cnt[key] = 0
m.key_cnt[key] += 1
if key = "down" and key.key_cnt[key] = 3:
//do something on the 3rd press of Down 🙂
end if
end if
return handled
end function
"EnTerr" wrote:
You need to persist the state between events. "m" comes to mind.function onKeyEvent(key as String, press as Boolean) as Boolean
handled = false
if press then
if m.key_cnt = invalid then m.key_cnt = {}
if m.key_cnt[key] = invalid then m.key_cnt[key] = 0
m.key_cnt[key] += 1
if key = "down" and key.key_cnt[key] = 3:
//do something on the 3rd press of Down 🙂
end if
end if
return handled
end function
"RENJITHVR4" wrote:
Thank you, bro. But I got an error - Syntax Error. (runtime error &h02), I have a doubt , is it key.key_cnt[key] or m.key_cnt[key] ?