I know they can be, because I found the documentation here:
It clearly states:
If you want to skip the cutscene approach, you can reload a scene from itself by calling:
local currScene = composer.getSceneName( “current” )
composer.gotoScene( currScene )
Oh, I so very much want to skip the cutscene approach. I’m not making a game as much as a game tool, a series of menus with random content, that would be great if I could “re-roll” the content without leaving the screen.
Through the use of composer.recycleOnSceneChange = true I’m able to get the scenes to refresh when navigating between them, but this does allow re-navigation as it were.
Navigation is being handled via the TabBar widget, handled by main.
local function onStreetsView( event ) composer.gotoScene( "streets" ) end local function onBuildingsView( event ) composer.gotoScene( "buildings" ) end local function onPeopleView( event ) composer.gotoScene( "people" ) end
Ideally, the same TabButtons that load the scenes would also reload the scenes. But if I need to add another button for that, I’m open to the idea.
I tried putting the above code snippet into the on…View functions, for no effect. I found if I put in a composer.destroyScene() I can almost get something like it. It will reload once, and only once after launch, and then throw errors and trouble. Not a solution.
In the scene itself, in the scene:create, scene:show, scene:hide, scene:destroy and even at the module level itself, before and after the scene declaration: local scene = composer.newScene(). All of these locations do Bad Things™. Namely some variation of:
ERROR: Runtime error
bad argument #1 to ‘find’ (string expected, got nil)
[C]: in function ‘error’
?: in function ‘gotoScene’
main.lua:17: in function ‘_onPress’
?: in function ‘_setSelected’
?: in function ‘?’
?: in function <?:190>
So, where am I supposed to put that code snippet? Or more to the point, what am I actually supposed to do to get scenes to reload without a cutscene?