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: 

SlideShow Example Anywhere?

Hi

As part of an app I'm writing I want to show a slideshow of user pictures.

I can see the commands ifSlideshow mentioned - with setcontent - etc.

But an example would allow me to understand it.

Is there a simple example anywhere that uses this command?

Thanks
0 Kudos
9 REPLIES 9
belltown
Roku Guru

Re: SlideShow Example Anywhere?

0 Kudos

Re: SlideShow Example Anywhere?

Many thanks - I will check that out.
0 Kudos

Re: SlideShow Example Anywhere?

Also...rather than a full blown slide show facility - is there a simple bit of code that will just take a url to a JPEG/JPG/PNG/GIF and display it on the screen until the user presses OK or back button?
0 Kudos
belltown
Roku Guru

Re: SlideShow Example Anywhere?

Sub Main ()
displayImage ("http://www.welikeviral.com/files/2014/12/8325_8_site.jpeg")
End Sub

Function displayImage (imageUrl As String) As Void
port = CreateObject ("roMessagePort")
ui = CreateObject ("roImageCanvas")
ui.SetMessagePort (port)
ui.SetRequireAllImagesToDraw (True)
ui.SetLayer (1, {Url: imageUrl})
ui.Show ()
While True
msg = Wait (0, port)
If Type (msg) = "roImageCanvasEvent"
If msg.IsScreenClosed ()
Exit While
Else If msg.IsRemoteKeyPressed ()
key = msg.GetIndex ()
If key = 0 ' Back Button
ui.Close ()
Else If key = 6 ' OK Button
ui.Close ()
EndIf
EndIf
EndIf
End While
End Function
0 Kudos
belltown
Roku Guru

Re: SlideShow Example Anywhere?

Or this:

Sub Main ()
displaySlideShow ([{Url: "http://www.welikeviral.com/files/2014/12/8325_8_site.jpeg"}])
End Sub

Function displaySlideShow (contentList As Object) As Void
port = CreateObject ("roMessagePort")
ui = CreateObject ("roSlideShow")
ui.SetMessagePort (port)
ui.SetContentList (contentList)
ui.Show ()
While True
msg = Wait (0, port)
If Type (msg) = "roSlideShowEvent"
If msg.IsScreenClosed ()
Exit While
Else If msg.IsRemoteKeyPressed ()
key = msg.GetIndex ()
If key = 0 ' Back Button
ui.Close ()
Else If key = 6 ' OK Button
ui.Close ()
EndIf
EndIf
EndIf
End While
End Function
0 Kudos

Re: SlideShow Example Anywhere?

Thanks so much.
0 Kudos

Re: SlideShow Example Anywhere?

Thanks again - another question...

With the ("roSlideShow") example - I see you passing across the url to the jpeg...
and I've looked at the documentation online - but non the wiser....

How do you pass across an array of files to let the slide show show all those images one after the other?
0 Kudos
belltown
Roku Guru

Re: SlideShow Example Anywhere?

"NewbyDeveloper" wrote:
Thanks again - another question...

With the ("roSlideShow") example - I see you passing across the url to the jpeg...
and I've looked at the documentation online - but non the wiser....

How do you pass across an array of files to let the slide show show all those images one after the other?


I'm actually passing an array of urls, hence the square brackets,[ ], around the url list.The list just happens to contain only one item, but could have been written like this, for example:

        displaySlideShow ([
{Url: "http://www.welikeviral.com/files/2014/12/8325_8_site.jpeg"}
{Url: "http://www.welikeviral.com/files/2015/01/Hide-And-Seek-3.jpg"}
{Url: "http://www.welikeviral.com/files/2015/01/Hide-And-Seek-5.jpg"}
])


Or this:

contentList = []
contentList.Push ({Url: "http://www.welikeviral.com/files/2014/12/8325_8_site.jpeg"})
contentList.Push ({Url: "http://www.welikeviral.com/files/2015/01/Hide-And-Seek-3.jpg"})
contentList.Push ({Url: "http://www.welikeviral.com/files/2015/01/Hide-And-Seek-5.jpg"})
displaySlideShow (contentList)
0 Kudos

Re: SlideShow Example Anywhere?

That's brilliant. Thanks.
0 Kudos