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.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
btpoole
Channel Surfer

Canvas will not update url

Creating a loading screen that will show different images at different time intervals. I have a basic counter set up that when a particular value is reached, the url is changed something like shown below:
The program steps thru each line, shows image1 but never shows imgage2. The counter reaches the correct number but the image doesn't change. What is missing?
Thanks

xcounter=0
canvas = CreateObject("roImageCanvas")
port = CreateObject("roMessagePort")
canvas.SetMessagePort(port)
while xcounter < 12
print xcounter

If xcounter <= 5 then
xcounter= xcounter + 1
sleep(1000)
myurl="pkg:/images/image1.png"
endif
If xcounter > 5 and xcounter <= 11 then
xcounter= xcounter + 1
sleep(1000)
myurl="pkg:/images/image2.png"
endif
if xcounter > 12 then
exit while
endif
canvasItems = [
{
url: myurl
TargetRect:{x:100,y:70,w:500,h:10}
},
{
Text:"LOADING STREAM. . ."
TextAttrs:{Color:"#FFCCCCCC", Font:"Medium",
HAlign:"HCenter", VAlign:"VCenter",
Direction:"LeftToRight"}
TargetRect:{x:130,y:10,w:300,h:60}
}
]
'SET OPAQUE BACKGROUND
canvas.SetLayer(0, {Color:"#FF000000", CompositionMode:"Source"})
canvas.SetRequireAllImagesToDraw(true)
canvas.SetLayer(1, canvasItems)
canvas.allowupdates(true)
canvas.Show()
end while
0 Kudos
2 REPLIES 2
EnTerr
Roku Guru

Re: Canvas will not update url

btpoole - please put your code between [code][/code] brackets, so formatting will be preserved.
0 Kudos
NewManLiving
Visitor

Re: Canvas will not update url

Did no look too closely but when I used the image
Canvas in the past I seem to recall that you
Had to call set layer again to refresh the screen
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.