Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jbrave
Channel Surfer

Roinput events & wait(x,port) beta 3.0

I'm encountering an issue where an roinput event is received at a port in a function and an old roinput event is waiting at the port in main() when the function returns. This appears to be the event left over from the event that launched the channel in the first place. Any way to "drain" the port so it doesn't contain an old event? Not sure if this is a bug or not, but it is causing me some trouble...

-Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
1 REPLY 1
renojim
Community Streaming Expert

Re: Roinput events & wait(x,port) beta 3.0

I don't know if this thread is similar to what you're seeing or not, but I used this code to eat the unexpected Back button that was waiting in the queue:
    ' eat possible Back button
msg = wait(100,port)
if type(msg) = "roImageCanvasEvent" then
if msg.isRemoteKeyPressed() then
print "Key Pressed - " ; msg.GetIndex()
end if
end if

Perhaps you could do something similar. Some sort of flush for the event queue might not be a bad addition to the SDK.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos