Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ajaypaudel
Visitor

redirect from one scene to another scene

Hello,
How can we redirect from one scene to another ?
Tags (1)
0 Kudos
2 REPLIES 2
NB_
Roku Guru

Re: redirect from one scene to another scene

these is no API currently for switching between Scene roSgNodes.
so as practical advice, work under the same roSgScreen and Scene, instead say use Group nodes as a "para-scenes": attach all elements for a given visual screen (aka design scene) under a single Group node, then attach that to the Scene. When need to change to a new screen, detach (or hide) that group, replace it with another. Functionally this will work the same as if the "master scene" was replaceable
Tags (1)
0 Kudos
devsmarquez
Reel Rookie

Re: redirect from one scene to another scene

Hi community I'm making an Roku app and I need to create window instance for can surf between it. The develop is inside the main fuction because is the only way that it works.

Also I need to create some moduls that it not depend of the main, I have been investigating and is nesessary the nodes use and task.

This's my code I wonder if you have some example using nodes and task

 

function ApiConnection()

m.nodo = createObject("roSGNode", "ContentReader")
m.nodo.observeField("content", "ApiConnectionLogin")
m.nodo.control = "RUN"

end function

 

sub ApiConnectionLogin()


data ={
username:m.txtuser.text,
password:m.txtPassword.text
}

 

body = FormatJSON(data)
port = CreateObject("roMessagePort")
request = CreateObject("roUrlTransfer")
request.SetMessagePort(port)
request.SetCertificatesFile("common:/certs/ca-bundle.crt")
request.RetainBodyOnError(true)
request.AddHeader("Content-Type", "application/json")
request.SetRequest("POST")
request.SetUrl("https://www.example.com")
requestSent = request.AsyncPostFromString(body)

if (requestSent)
msg = wait(0, port)
if (type(msg) = "roUrlEvent")
body = msg.GetString()
print body

m.view = createObject("roSGNode", "ContentReader")
m.view.observeField("content", "ShowGridScreen")
m.view.control = "RUN"

end if
end if

end sub

 

sub ShowGridScreen()


screen = CreateObject("roSGScreen")
port = CreateObject("roMessagePort")
screen.setMessagePort(port)
scene = screen.CreateScene("playerscreen")
screen.show()

end sub

 

0 Kudos
Community is Being Upgraded!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

We're sorry for this disruption — we’re excited to share what’s next!