When you press a button, you will get 2 events. First, you will get the press event (i.e. 2), then you release the button, you get the release event (i.e. 102). That allows a lot of flexibility. If you want to enforce only receiving "presses", then just set a release var when you get the press event, and clear it when you get the release event. (If you're not sure what I mean, I can give you a piece of code)
Also, I don't know if it makes a difference to roku, but I recommend making a small change to your code. Instead of using:
if msg.getint() = 2 then
...
else if msg.getint() = 3 then
...
Use this instead:
key = msg.getint()
if key = 2 then
....
else if key = 3 then
...
YungBlood
Bringing more fun to Roku!