I have a Scene with two custom screens on it. One screen is a landing page with a RowList, containing multiple rows of videos. When a user selects an item from one of the rows, it will launch a video screen on top of the first screen. The goal is to have the content from the focused row on the first screen to be passed to the video screen, so there can be a single row at the bottom of the video player.
Passing the row content to the video screen is the easy part, but when I close the video player, the row content that I passed is missing from the landing screen. Clearly, my use if "appendChild" in the VideoScreen.brs code below is causing the original row content to change. I'm looking for a way to clone the row content, as to not affect the original content. Or possibly another way to structure my contentnode so I can easily pass nodes around without modifying them.
'' **
'' MainScreen.brs
'' **
function getPlaylistsContent()
? "loading playlists"
m.playlistsContentRequest = createObject("roSGNode", "playlistsContentRequest")
m.playlistsContentRequest.uri = m.top.playlistsContentUri
m.playlistsContentRequest.observeField("content", "showPlaylists")
m.playlistsContentRequest.control = "RUN"
end function
sub showPlaylists()
? "showing playlists"
m.playlists = m.playlistsContentRequest.content
end sub
function playlistItemSelected()
print "this is how the playlist is passed to the video screen"
m.videoScreen.playlist = m.playlists.getChild(m.rowItemSelected[0])
end function
'' **
'' PlaylistContentRequest.brs
'' **
sub getContent()
util = Utils()
content = createObject("RoSGNode", "ContentNode")
request = ParseJson(util.getStringFromURL(m.top.uri))
response = request.response
for each playlist in response.data.playlists
playlistItem = content.createChild("ContentNode")
playlistItem.title = playlist.name
for each item in playlist.items
videoData = item.video
video = playlistItem.CreateChild("VideoItemData")
video.title = videoData.title
video.hdPosterURL = videoData.thumbnailList[1].url
video.sdPosterURL = videoData.thumbnailList[2].url
end for
end for
m.top.content = content
end sub
'' **
'' VideoScreen.brs
'' **
function playlistChanged()
print "Playlist loaded to video screen"
data = CreateObject("roSGNode", "ContentNode")
''This is where I want to clone or shallow copy m.top.playlist
data.appendChild(m.top.playlist)
m.playlistRow.content = data
end function
Please help!
Greg Roman
Senior Software Engineer, AOL Alpha