I am attempting the same thing using the videoplayer example. I have one category that pulls a feed from my xml file, but I am trying to setup an About Us page with a few lines of text, header, etc. I have used some of the code above to get to the point where it gives me another poster image on my home screen, but it won't go to my "About Us" page.
I think it may be something wrong with the aboutUs.brs file that I created. Here is what I am getting from the Brightscript Debugger:
created feed connection for http://selectbroadcasting.org/roku/examples/source/
RBS/xml/categories.xml
url: http://selectbroadcasting.org/roku/examples/source/SRBS/xml/categories.xml
Took: 197ms
Parse Took: 0ms
begin category node parsing
number of categories: 1
ParseCategoryNode: category
category: Recent Episodes | Watch Recent Episodes
categoryLeaf: Time for Hope TV Episodes []
ParseCategoryNode: categoryLeaf
added new child node
Traversing: 0ms
showHomeScreen | msg = | index = 0
showHomeScreen | msg = | index = 1
showHomeScreen | msg = | index = 1
list item selected | index = 1
Current Function:
035: Function showHomeScreen(screen) As Integer
036:
037: if validateParam(screen, "roPosterScreen", "showHomeScreen") = false r
turn -1
038:
039: initCategoryList()
040: screen.SetContentList(m.Categories.Kids)
041: screen.SetFocusedListItem(3)
042: screen.Show()
043:
044: while true
045: msg = wait(0, screen.GetMessagePort())
046: if type(msg) = "roPosterScreenEvent" then
047: print "showHomeScreen | msg = "; msg.GetMessage() " | index =
; msg.GetIndex()
048: if msg.isListFocused() then
049: print "list focused | index = "; msg.GetIndex(); " | categ
ry = "; m.curCategory
050: else if msg.isListItemSelected() then
051: print "list item selected | index = "; msg.GetIndex()
052: kid = m.Categories.Kids[msg.GetIndex()]
053: if kid.type = "About Us" then
054: 'print "About Us"
055: aboutUs = ShowParagraphScreen()
056: else if kid.type = "special_category" then
057: displaySpecialCategoryScreen()
058: else
059: displayCategoryPosterScreen(kid)
060: end if
061: else if msg.isScreenClosed() then
062: return -1
063: end if
064: end If
065: end while
066:
067: return 0
068:
069: End Function
Wrong number of function parameters. (runtime error &hf1) in ...pkg:/source/app
omeScreen.brs(55)
055: aboutUs = ShowParagraphScreen()
Backtrace:
Function showhomescreen(screen As ) As Integer
file/line: /tmp/plugin/PEAAAAgwIL...pkg:/source/appHomeScreen.brs(55)
Function main() As
file/line: /tmp/plugin/PEAAAAgwILaT/pkg:/source/appMain.brs(20)
Local Variables:
screen &h0010 bsc:roPosterScreen, refcnt=2
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=3
msg &h0010 bsc:roPosterScreenEvent, refcnt=1
kid &h4010 bsc:roAssociativeArray, refcnt=2
aboutus &h0000 <uninitialized> val:Uninitialized
My About Us page code is like this:
Function showParagraphScreen(screen) As Integer
' borrow some pictures from the monitor setup program
host = "http://rokudev.roku.com/rokudev/testpatterns/"
screen.SetTitle("Title Text")
screen.AddHeaderText("Header Text")
screen.AddParagraph("Paragraph Text")
adUrl = host + "1280x720" + "/SMPTE_bars_setup_labels_lg.jpg"
print "adUrl=" + adUrl
screen.AddGraphic(adURL,"scale-to-fit")
screen.AddButton(1,"Close")
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
print "got message"
if type(msg) = "roParagraphScreenEvent"
if msg.isScreenClosed()
print "Screen closed"
exit while
else if msg.isButtonPressed()
print "Button pressed: "; msg.GetIndex(); " " msg.GetData()
exit while
else
print "Unknown event: "; msg.GetType(); " msg: "; msg.GetMessage()
exit while
endif
endif
end while
End Function
Here is the complete code for my appHomeScreen.brs:
Function preShowHomeScreen(breadA=invalid, breadB=invalid) As Object
if validateParam(breadA, "roString", "preShowHomeScreen", true) = false return -1
if validateParam(breadA, "roString", "preShowHomeScreen", true) = false return -1
port=CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if
screen.SetListStyle("flat-category")
screen.setAdDisplayMode("scale-to-fit")
return screen
End Function
'******************************************************
'** Display the home screen and wait for events from
'** the screen. The screen will show retreiving while
'** we fetch and parse the feeds for the game posters
'******************************************************
Function showHomeScreen(screen) As Integer
if validateParam(screen, "roPosterScreen", "showHomeScreen") = false return -1
initCategoryList()
screen.SetContentList(m.Categories.Kids)
screen.SetFocusedListItem(3)
screen.Show()
while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
print "showHomeScreen | msg = "; msg.GetMessage() " | index = "; msg.GetIndex()
if msg.isListFocused() then
print "list focused | index = "; msg.GetIndex(); " | category = "; m.curCategory
else if msg.isListItemSelected() then
print "list item selected | index = "; msg.GetIndex()
kid = m.Categories.Kids[msg.GetIndex()]
if kid.type = "About Us" then
'print "About Us"
aboutUs = displayParagraphScreen()
else if kid.type = "special_category" then
displaySpecialCategoryScreen()
else
displayCategoryPosterScreen(kid)
end if
else if msg.isScreenClosed() then
return -1
end if
end If
end while
return 0
End Function
'**********************************************************
'** When a poster on the home screen is selected, we call
'** this function passing an associative array with the
'** data for the selected show. This data should be
'** sufficient for the show detail (springboard) to display
'**********************************************************
Function displayCategoryPosterScreen(category As Object) As Dynamic
if validateParam(category, "roAssociativeArray", "displayCategoryPosterScreen") = false return -1
screen = preShowPosterScreen(category.Title, "")
showPosterScreen(screen, category)
return 0
End Function
'**********************************************************
'** Special categories can be used to have categories that
'** don't correspond to the content hierarchy, but are
'** managed from the server by data from the feed. In these
'** cases we might show a different type of screen other
'** than a poster screen of content. For example, a special
'** category could be search, music, options or similar.
'**********************************************************
Function displaySpecialCategoryScreen() As Dynamic
' do nothing, this is intended to just show how
' you might add a special category ionto the feed
return 0
End Function
'************************************************************
'** initialize the category tree. We fetch a category list
'** from the server, parse it into a hierarchy of nodes and
'** then use this to build the home screen and pass to child
'** screen in the heirarchy. Each node terminates at a list
'** of content for the sub-category describing individual videos
'************************************************************
Function initCategoryList() As Void
conn = InitCategoryFeedConnection()
m.Categories = conn.LoadCategoryFeed(conn)
m.Categories.Kids.Push({ Type: "About Us", ShortDescriptionLine1: "About Us", ShortDescriptionLine2: "Learn More about ", HDPosterUrl: "pkg:/images/hd-aboutus.png", SDPosterUrl: "pkg:/images/sd-aboutus.png" })
m.CategoryNames = conn.GetCategoryNames(m.Categories)
End Function
I would really appreciate any help!!
Thanks!