Roku 如何更改按键上矩形的高度?

Roku 如何更改按键上矩形的高度?,roku,brightscript,Roku,Brightscript,我想知道当用户按下遥控器时,如何改变盒子的高度 以下是组件: <component name="PlutoScene" extends="Scene"> <script type="text/brightscript" uri="pkg:/components/homescreen.brs" /> <children> <LayoutGroup id="root"> <Rectangle id="hea

我想知道当用户按下遥控器时,如何改变盒子的高度

以下是组件:

   <component name="PlutoScene" extends="Scene">

   <script type="text/brightscript" uri="pkg:/components/homescreen.brs" />

   <children>
    <LayoutGroup id="root">
     <Rectangle id="header" width="1280" height="300" color="0x000000"> 
  </Rectangle>
  <LayoutGroup id="body" layoutDirection="horiz">
    <Rectangle id="rect1" height="270" width="400" color="0xffffff" />
    <Rectangle id="rect2" height="270" width="2" color="0x000000" />
    <Rectangle id="rect3" height="270" width="878" color="0xffffff" />
  </LayoutGroup>
  <Rectangle id="footer" width="1280" height="150" color="0x000000">
  </Rectangle>
</LayoutGroup>
 </children>
</component>

比那简单。将您的onKeyEvent更改为:

function onKeyEvent(key as String, press as Boolean) as Boolean
 if press then
  if (key = "Up") then
  m.rect1.height = m.rect1.height * 2
  end if
 end if
end function

比那简单。将您的onKeyEvent更改为:

function onKeyEvent(key as String, press as Boolean) as Boolean
 if press then
  if (key = "Up") then
  m.rect1.height = m.rect1.height * 2
  end if
 end if
end function