Forum Discussion

alexboyer's avatar
alexboyer
Visitor
12 years ago

Timed event within roSpringboardScreen

Hello,

I was wondering if there was a way to add a timed event to fire every 10 seconds or so. For example, if you're sitting on the springboard screen, ever 10 seconds the star rating could get checked or something. Is that possible?

Thanks!

5 Replies

  • Yes. You could use msg=wait(600000,port) or you could set up a timer:


    timer=createobject("roTimeSpan")
    timer.mark()
    While True
    msg=port.getmessage()
    if timer.totalseconds() > 600 then
    content.starRating=checkStarRating()
    timer.mark()
    screen.setcontent(content)
    end if
    if type(msg)="roSpringboardScreenEvent" then
    if msg.isbuttonPressed() then
    if msg.getindex() = 0 then
    playContent(content)
    else if
    ...
  • Ah so you can check for multiple event types within the same while loop? Nice. Thanks!
  • Yes. There may be some instances where it works better to use a separate port and if/then statement, specifically if you have an roScreen and async roURLTransfers, probably best if they are each on their own port.

    - Joel
  • Wanted to let you know that suggestion worked very well. Thanks Joel!