btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2014
04:33 PM
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
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
2 REPLIES 2
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2014
05:11 PM
Re: Canvas will not update url
btpoole - please put your code between [code][/code] brackets, so formatting will be preserved.

NewManLiving
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2014
06:08 PM
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
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 )
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )