Hello there.I’m having trouble changing one scene to the next.I have a button that says “Piano” in the menu.lua file, and I need to know how to go to the next scene, which is the piano.lua file, by clicking it.
Here’s the code below. It’s not complete, yet:
– This below causes all contents,
– including images and text,
– to fit on the screen on all mobile devices.
local scalex = display.contentScaleX
local scaley = display.contentScaleY
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local bg = display.newImage(“piano_small.jpg”,0,0)
–Start
function scene:createScene (event)
local group = self.view
– This is to display the text on the screen.
local lessonsBtn = display.newImage( “button_lessons.PNG”, 0, 0)
lessonsBtn.x = display.contentWidth / 2
lessonsBtn.y = display.contentWidth / 1.2
local pianoBtn = display.newImage( “button_piano.PNG”, 0, 0)
pianoBtn.x = display.contentWidth / 2
pianoBtn.y = display.contentWidth / 0.9
end
function scene:enterScene (event)
local group = self.view
end
function scene:exitScene (event)
local group = self.view
end
function scene:destroyScene (event)
local group = self.view
end
–End
scene:addEventListener( “createScene”, scene )
scene:addEventListener( “enterScene”, scene )
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )
return scene
If anyone can explain me how, I would be appreciate it. Thanks.
[import]uid: 162639 topic_id: 29344 reply_id: 329344[/import]