How would I send data to a scene graph instance? I just need to send a single string to the init() function. I cant really find a way to do this.
I’ve tried to set an interface and listener inside my “videoDetailScene”, but the listener is never fired when I call the scene.setField below:
scene = screen.CreateScene("videoDetailScene")
screen.show()
scene.setField("workid", "20000")
How did you set up the workid field in the section of the videoDetailScene XML? You would need to set the onChange field to the specific function you want to call when you set the workid.
The problem you are probably seeing is that the init() function is called when you call screen.show() so if you are reading the workid in the init, you need to set it before you call screen.show()
That was it, thank you so much for that insight. I was adding an ObserveField in the init():
m.top.ObserveField("workid", workidChange)
but it never worked. Adding the ‘onChange’ in the interface works like a charm. Not sure how I missed that.
<field id="workid" type="String" onChange="workidChange"/>
My experience with this forum is rather frustrating. So many questions I have were already asked but most of them simply left unanswered or unsolved in single-post threads.
At least I can help in this case:
Wrong:
m.top.ObserveField("workid", workidChange)
Right:
m.top.ObserveField("workid", "workidChange")