squirreltown
13 years agoRoku Guru
No loop
Is there a way to get an Event, for instance an roAudioplayer status message without a message loop? Or to make a loop that loops once and exits? I need to get the info at the start of a function, ...
port = CreateObject("roMessagePort")
screen = CreateObject("roSpringboardScreen")
screen.SetMessagePort(port) ' instruct screen to send events to port
screen.Show()
while true
msg = wait(0, port) ' wait for a message
if type(msg) = "roSpringboardScreenEvent" then
if msg.isScreenClosed() then
return -1
elseif msg.isButtonPressed()
print "button pressed: ";msg.GetIndex()
else
' ignore other unknown or uninteresting roSpringBoardScreenEvents
endif
else
' ignore other events, not type roSpringboardScreenEvent
endif
end while
port = CreateObject("roMessagePort")
screen = CreateObject("roSpringboardScreen")
screen.SetMessagePort(port) ' instruct screen to send events to port
screen.Show()
while true
msg = wait(0, port) ' wait for a message
if type(msg) = "roSpringboardScreenEvent" then
if msg.isScreenClosed() then
return -1
elseif msg.isButtonPressed()
print "button pressed: ";msg.GetIndex()
EXIT WHILE
else
' ignore other unknown or uninteresting roSpringBoardScreenEvents
endif
else
' ignore other events, not type roSpringboardScreenEvent
endif
end while