Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Streaming Star

Show Label in screen saver

I am trying to create a pretty simple screen saver; one with only a label that displays the current time.
So far I am only getting a blank screen. My label isn't even showing up.
Here's my code: 


function init()
   m.Label ="time")"MyField", "getCurrentTime")
end function

function getCurrentTime()
    time = CreateObject("roDateTime")
    newTime = time.toISOString()
    print newTime
    arr = newTime.split("T")
    print "Time is: " arr[1]
    m.Label.text = arr[1]
end function



sub RunScreenSaver()
   screen = createObject("roSGScreen")
    port = createObject("roMessagePort")
    port2 =  createObject("roMessagePort")
    screen.setMessagePort(port) = screen.getGlobalNode() 'Creates (Global) variable MyField"MyField", "int", true) = 0
    scene = screen.createScene("ScreensaverFade")

    while(true) 'Message Port that fires every 7 seconds to change value of MyField if the screen isn't closed
        msg = wait(7000, port)
        if (msg <> invalid)
            msgType = type(msg)
            if msgType = "roSGScreenEvent"
                if msg.isScreenClosed() then return
            end if
   += 10
            msg = wait(2500, port2)
        end if
    end while
end sub

Also, another minor issue, the time I am getting displays the date as well, so I used split to separate, now I get something like 09:30:22Z, what is his Z and how to remove it, and how to get my label to show up.
Thanks a lot!


0 Kudos