btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2016
04:33 PM
OnKeyEvent Loop?
Having a problem that makes no sense, well not to me. I start out with a preview video component set up in the corner of the screen. A video is selected and started, if the user presses the star button the screen is suppose to go full screen. This works but the screen goes from preview to full screen back to preview almost like it's in a loop. My onkeyevent is
The code for the screenchange() follows
Once the video starts initially in small screen and the star is press it does go to screenchange, changes to full screen but right back to small screen. Seems like it skips the else in the if statement. Am I overlooking something simple?
Thanks
function onKeyEvent(key as String, press as Boolean) as Boolean
handled = false
if (m.simpleMarkupList.hasFocus() = true) and (key = "right") and (press=true)
m.simpleMarkupGrid.setFocus(true)
m.simpleMarkupList.setFocus(false)
m.simpleMarkupGrid.horizFocusAnimationStyle="floatingFocus"
m.top.Description.visible=true
?"key "key
handled = true
else if (m.simpleMarkupGrid.hasFocus() = true) and (key = "left") and (press=true)
m.simpleMarkupGrid.setFocus(false)
m.simpleMarkupList.setFocus(true)
m.top.Description.visible=false
handled = true
else if (m.video.hasfocus()=true) and (key="options")
?"key "key
screenchange()
handled= true
end if
return handled
end function
The code for the screenchange() follows
sub screenchange()
if m.video.width=300
m.video.width="1280"
m.video.height="720"
m.video.translation="[0,0]"
?"CURRENT SCREEN IS NOW FULL"
else
m.video.width="300"
m.video.height="150"
m.video.translation="[400,70]"
?"CURRENT SCREEN IS NOW SMALL"
end if
end sub
Once the video starts initially in small screen and the star is press it does go to screenchange, changes to full screen but right back to small screen. Seems like it skips the else in the if statement. Am I overlooking something simple?
Thanks
2 REPLIES 2
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2016
06:48 PM
Re: OnKeyEvent Loop?
Looks like you're missing:
so screenchange() will fire on both the options key press and the release.
and (press=true)
so screenchange() will fire on both the options key press and the release.
btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2016
09:01 AM
Re: OnKeyEvent Loop?
Thank you belltown that did it.