Well, I can't go into a full step by step here, but:
Generally speaking, you start with a Sub Main:
Sub main()
you create a screen:
screen=createobject("roPosterScreen")
the items you see on a screen, which represent media items are built on type roAssociativeArray, a simple example:
item={Title:"A Movie"
ShortDescriptionLIne1:"Actors doing stuff on Film"
ShortDescriptionLIne2:"filmed in HD"
hdPosterURL:"http://www.mywebsite.com/AMovie/HDimage.jpg"
sdPosterURL:"http://www.mywebsite.com/AMovie/SDimage.jpg"}
Multiple associative arrays are pushed into an Array:
mediaarray=[item,item,item]
The content is loaded into the screen:
screen.setContentList(mediaarray)
and then you show the screen:
screen.show()
typically, you want to create a message port, so you can listen for input from the user, and assign that port to the screen:
port=createobject("roMessagePort")
screen.setMessagePort(port)
A while loop and if/then statements are used to listen for and respond to messages on the port:
While True
msg=wait(0,port)
if type(msg)="roPosterScreenEvent" then
ndx=msg.getindex()
if msg.isListItemSelected() then
print " you clicked on ";mediaarray[ndx]
else if msg.isScreenClosed() then
return
end if
end if
end while
and you need to close your Sub Main() with an End Sub.
executable code is stored in the source folder in a project and the files must end in .brs
The name of the source files don't matter except as human reference points to the content of the files. A complete program could look like this:
Sub main()
screen=createobject("roPosterScreen")
item={Title:"A Movie"
ShortDescriptionLIne1:"Actors doing stuff on Film"
ShortDescriptionLIne2:"filmed in HD"
hdPosterURL:"http://www.mywebsite.com/AMovie/HDimage.jpg"
sdPosterURL:"http://www.mywebsite.com/AMovie/SDimage.jpg"}
mediaarray=[item,item,item]
screen.setContentList(mediaarray)
screen.show()
port=createobject("roMessagePort")
screen.setMessagePort(port)
While True
msg=wait(0,port)
if type(msg)="roPosterScreenEvent" then
ndx=msg.getindex()
if msg.isListItemSelected() then
print " you clicked on ";mediaarray[ndx]
else if msg.isScreenClosed() then
return
end if
end if
end while
End Sub
I suggest you open an example like simpleposter in the SDK, open the .brs file in the source folder and erase everything inside it, and use it as a testbed for experimenting with Brightscript programming, for example, you could paste the above code in and see what happens when you load it onto your device and run it.
- Joel