[Resolved] Scene Change Help

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. :slight_smile: [import]uid: 162639 topic_id: 29344 reply_id: 329344[/import]

You can look at the storyboard example installed by the SDK…
but here is how you go from screen to screen.

storyboard.gotoScene( "Piano", "fromLeft", 200 )  

Larry [import]uid: 11860 topic_id: 29344 reply_id: 117951[/import]

Hey there - the above is correct but just wanted to add, please, post your code in < lua > or < code > tags as Larry did above - much more legible! [import]uid: 52491 topic_id: 29344 reply_id: 118028[/import]

The storyboard.gotoScene code works. Now I need to know to make the Piano button clickable, so when the user clicks it, it’ll take him to the next scene. Thanks. :slight_smile: [import]uid: 162639 topic_id: 29344 reply_id: 118322[/import]

Thank you for giving me your input; however, after using your suggestions I found I still have a problem. I have a menu.lua file that has two options, and when a person clicks on one of the options I would like it to send him to a separate piano.lua file. Could you please give me some advice? [import]uid: 162639 topic_id: 29344 reply_id: 118543[/import]