I'm trying to implement multipage application with groovyfx and i'm stuck with the scene changing. Suppose i have the following code:
start {
stage(id: 'stageId', title: 'sometitle'){
scene(id:'scene1'){
button(text:'goto scene 2', onAction: {/* i guess i should do something here` */})
}
scene(id:'scene2'){
label(text:'this is scene 2')
}
}
}
what should i put to button's action to be able to go to scene 2?
You should be able to do:
stageId.scene = scene2
Behind the scenes, that will get the element with the id stageId
(the main stage
), and then call setScene( scene2 )
(where scene2
is the id of the second scene)
Hope this explains it :-)