class MyDelegate extends Ui.InputDelegate {
function onKey(event)
{
var key = event.getKey();
var app = App.getApp();
if(Ui.KEY_MENU == key)
{
Ui.pushView(new Rez.Menus.MainMenu(), new MainMenuDelegate(), Ui.SLIDE_IMMEDIATE);
}
else if(Ui.KEY_DOWN == key)
{
Ui.switchToView(app.getNextView(), new MyDelegate(), Ui.SLIDE_IMMEDIATE);
}
else if(Ui.KEY_UP == key)
{
Ui.switchToView(app.getNextView(false), new MyDelegate(), Ui.SLIDE_IMMEDIATE);
}
return true;
}
}
Also, you do not have to declare the return value of a function, or even if a function returns a value, because all functions return values. You can specify the return value with a return statement, but if your function doesn’t have a return statement it will return the last value on the stack.