我在我的项目中使用滑动板。假设我在一个面板集中有面板A(在左边)和面板B(在右边)。现在我从B滑到面板C,现在我的面板集有面板B和C。类似地,我继续往下走,现在面板集有面板E(在左边)和面板F(在右边)。
现在我想要我的面板设置为滑动,一旦我做了一些动作(比如按下面板F上的按钮),就直接显示初始面板A和B。
如何才能做到这一点?这与你在Roku主屏幕上看到的行为类似。例如:如果我在Roku标题样式设置上,并按下主页按钮,屏幕将滑回到主页列表和动画到主页选项,而不管在两者之间存在多少面板。我尝试了面板的goBackCount属性,但没有用。请帮帮忙。
发布于 2018-01-26 12:02:33
在将goBackCount设置为大于1的值之后,尝试调用onKeyEvent()函数并传递"key“和"press”参数,如下所示:onKeyEvent("left", true)。如果我正确理解了Roku文档,goBackCount只有在按下“左”遥控键之后才能工作。
发布于 2018-05-24 21:45:31
我使用Roku任务和ECP(外部控制API)让它工作。首先,我创建了一个任务来执行ECP调用,以按下远程按钮。RemoteControlTask.xml:
<component name = "RemoteControlTask" extends = "Task" >
<interface>
<field id = "url" type = "string" />
<field id = "content" type = "node" />
</interface>
<script type = "text/brightscript" >
<![CDATA[
sub init()
m.deviceIP = GetDeviceIP()
m.top.functionName = "SlideLeft"
end sub
function PressKey(key as String)
request = CreateObject("roUrlTransfer")
request.SetRequest("POST")
port = CreateObject("roMessagePort")
request.SetMessagePort(port)
url = "http://" + m.deviceIP + ":8060/keypress/" + key
request.SetUrl(url)
if(request.AsyncGetToString())
while(true)
msg = wait(0, port)
if(type(msg) = "roUrlEvent")
code = msg.GetResponseCode()
if(code = 200)
return true
else
print code
end if
else if(event = invalid)
request.AsyncCancel()
end if
end while
end if
return invalid
end function
function SlideLeft()
PressKey("left")
end function
function GetDeviceIP() as String
device = CreateObject("roDeviceInfo")
deviceIP = device.GetIPAddrs()["eth1"]
return deviceIP
end function
]]>
</script>
</component>然后,在将触发回滚的脚本中,将以下内容添加到init()方法:
m.remoteControlTask = CreateObject("roSGNode", "RemoteControlTask")并添加子例程:
sub RunRemoteControlTask()
m.remoteControlTask.control = "RUN"
end sub最后,在按下按钮时调用RunRemoteControlTask:
RunRemoteControlTask()https://stackoverflow.com/questions/48437421
复制相似问题