Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kooljay68
Level 7

Send value from showFeed.brs to appVideoScreen.brs

How do I send a value to a function in the appVideoScreen.brs from showFeed.brs?

I am using: m.value = item.value

but when I call the m.value in the function on the appVideoScreen.brs it says invalid ?
0 Kudos
2 REPLIES 2\
RokuMarkn
Level 8

Re: Send value from showFeed.brs to appVideoScreen.brs

That is one way to do it and it should work. What you're saying here contradicts what you said in the other thread:

when I set them in showFeed.brs

m.cost = item.cost
m.model = item.modelId

print "cost "; m.cost
print "model "; m.model

the debug shows the correct values:

cost 25
model 22


Also, although what you're doing should work, it's not very good style to use global variables to pass information around. It would be better to pass your item AA into the functions that need it as a parameter.

--Mark
0 Kudos
kooljay68
Level 7

Re: Send value from showFeed.brs to appVideoScreen.brs

here is the code:


Function showVideoScreen(episode As Object)

if type(episode) <> "roAssociativeArray" then
print "invalid data passed to showVideoScreen"
return -1
endif

print "cost "; m.cost

port = CreateObject("roMessagePort")
screen = CreateObject("roVideoScreen")
screen.SetMessagePort(port)

screen.Show()
screen.SetPositionNotificationPeriod(30)
screen.SetContent(episode)
screen.Show()


here is the debug ??


ButtonPressed
ButtonPressed
cost invalid
showHomeScreen | msg = An unexpected problem (but not server timeout or HTTP error) has been detected. | index = -3
Video request failure: -3 0
showHomeScreen | msg = | index = 0
Screen closed
0 Kudos