-2

I tried to change the value on the keypress event one Roku. I set 10 as a middle value and press the right key to increment 11,12,13 and press left to 9,8,7. Is It possible in Roku?

1 Answers1

1

I don't know for what reason you are doing this, You can try this below code:

Initialize the values in init()

sub init()
    m.leftValue = 10
    m.rightValue = 10
end sub

You can handle the on key events here:

function onKeyEvent(key as String, press as Boolean) as Boolean
? "in onKeyEvent "; key; " "; press
if press then
    if key = "right"
        if m.rightValue < 13
            m.rightValue = m.rightValue + 1
        else
            m.rightValue = 10
            m.rightValue = m.rightValue + 1
        end if
        ? "rightValue--->>>"; m.rightValue
        return true
    else if key = "left"
        if m.leftValue > 7
            m.leftValue = m.leftValue - 1
        else
            m.leftValue = 10
            m.leftValue = m.leftValue - 1
        end if
        ? "leftValue--->>>"; m.leftValue
        return true
    end if
end if
return false
end function
Archana
  • 378
  • 3
  • 17