ive been trying to switch been screens, home screen and details screen through a manager file but its not working for some reason and here is the code can anyone help?
I'm not long into dealing with (learning) Roku, so pardon any non-applicable points.
First glance:
1. Your initscreenstack() in manager.brs doesn't appear to be called, so m.scenegroup isn't instanced.
2. Is the abstraction of [manager.xml/brs] taking on a controlling duty, rather than the [mainscene.xml/brs], worth it?
If so:
2b. Don't include the extra <script> for manager.brs in your mainscene.xml. When you want .brs scripts included by multiple components, make them separate .brs files not tied to any components. For example: if component.brs is serving as the script init() backing to component.xml, then don't include that in differentcomponent.xml, otherwise it leads to confusion with unclear context; make a separate shared.brs file.
2c. Then in manager.brs you can change initscreentstack() to init() and it won't conflict.
2d. Then in mainscene.brs at handling the back button, call your interface function for closeScreen: m.manager.callFunc("closeScreen"), as you did with showScreen, instead of closeScreen().
3. The mainscene.brs OnKeyEvent doesn't return the result. Though it does in your commented-out version.
Any luck?
yup thanks for that i got it and tried it and its not crashing but now the problem is that it is not displaying anything and when i tried to debug it returns an empty component
<Component: roSGNode:Manager> =
{
childRenderOrder: "last"
clippingRect: <Component: roAssociativeArray>
enableRenderTracking: false
inheritParentOpacity: true
inheritParentTransform: true
muteAudioGuide: false
opacity: 1
renderPass: 0
renderTracking: "disabled"
rotation: 0
scale: <Component: roArray>
scaleRotateCenter: <Component: roArray>
translation: <Component: roArray>
visible: true
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id: ""
}
Could someone please help me in switching screen from roScreen to roSGScreen and then come back to roScreen
@surendra019, I've mixed roScreen and roSGScreen and it's a bit of a mess. It depends on what you mean by "come back to roScreen". I recreate the roScreen after the roSGScreen closes. I don't try to preserve it and I don't know if it's possible.
At the beginning of RunUserInterface, I create a roScreen that lives for the duration. Without that, the app would close when the roSGScreen closes. From there I go back and forth between the two screen types:
I've probably tried variations of this approach over the years, but this is what I've settled on. I keep waiting for a Roku update to break it.
Yes, I tried that it works, but the issue here is that I have a dialog opened in the roSGScreen and I want open the roScreen on back button pressed, the channel stucks if I try to do that. Actually i am implementing In -app purchases. Here is my project (any help or suggestion would be appreciated)-
https://drive.google.com/file/d/1df2EXQYny1JnO-0VuR6x9k-BoViojgSA/view?usp=sharing
This **bleep**ty "community" site caused me to lose my response, so I'll try to paraphrase it.
You shouldn't call CheckSubscription from your MainScene's init function. Your code will never reach the statement in Main.brs after "scene = ...". Let the creation of the scene complete before you start using it. You also have functions with identical names in different files. That can only cause confusion.
I think I've only used roChannelStore, not the SG ChannelStore stuff, so I don't know how much help I can be not to mention I hate debugging scene graph.
Sorry for the mistake, could you please tell me then where to call it actually I am a beginner.