I try to switch scenes into a storyboard, but when I click the button, it saves the current scene ... I could not find a solution to this problem anywhere on the Internet. The terminal indicates that it gets to a method that displays "exit the main menu", and my next scene opens successfully, but the background and button remain from the original scene.
local storyboard = require( "storyboard" ) local widget = require "widget" local scene = storyboard.newScene() local function onButton(event) --local btn = event.target --storyboard.gotoScene("sceneTemplate") if event.phase == "release" then print("play pressed") storyboard.gotoScene("sceneTemplate") end end function scene:createScene( event ) local group = self.view print("menu scene created") end function scene:enterScene( event ) local group = self.view print("menu scene viewing!") local bgImage = display.newImage("images/mainBG.png",0,0); local playButton = widget.newButton{ default = "images/playUp.png", over = "images/playDown.png", onEvent = onButton } playButton.x = 80 playButton.y = 20 end function scene:exitScene( event ) local group = self.view print("leaving main menu") storyboard.removeScene("menu") storyboard.removeAll() display.remove(group) group:removeSelf() end
source share