back button doesnt take to previous screen

here is the start.lua code

[code]local storyboard = require “storyboard”

local scene = storyboard.newScene()

local function touchPlay( event )
if event.phase == “began” then
storyboard.gotoScene(“scene1”)
end
return true
end

local button1 = display.newRect( 0,0,50,50)
button1:setFillColor( 0, 180, 50)
button1:setReferencePoint(display.CenterReferencePoint)
button1.x = 200
button1.y = 200

button1:addEventListener( “touch”, touchPlay )
[/code]
and here is scene1.lua

[code]local storyboard = require “storyboard”

local scene = storyboard.newScene()

local start = storyboard.getPrevious()

local background = display.newRect( 0,0,360,640)
background:setFillColor( 150, 180, 0)
background:setReferencePoint(display.CenterReferencePoint)
background.x = 180
background.y = 320

local box1 = display.newRect( 0,0,50,50)
box1:setReferencePoint(display.CenterReferencePoint)
box1.x = 200
box1.y = 300

local box2 = display.newRect( 0,0,50,50)
box2:setReferencePoint(display.CenterReferencePoint)
box2.x = 100
box2.y = 300

local function touchPlay( event )
if event.phase == “began” then
storyboard.gotoScene(“start”)
end
return true
end

local back = display.newRect( 0,0,50,25)
back:setFillColor( 250, 0, 0)
back:setReferencePoint(display.CenterReferencePoint)
back.x = 60
back.y = 580

back:addEventListener( “touch”, touchPlay ) [import]uid: 218976 topic_id: 35950 reply_id: 143071[/import]

Neither of those lua files are storyboard scenes. They are missing the required event handlers for createScene, enterScene, exitScene, etc and you are never adding any thing to the scene 's view group for storyboard to manage.

[import]uid: 199310 topic_id: 35950 reply_id: 143128[/import]

Okay. Can you show me an example maybe or explain what I need and how the storyboard works, order in which things are suppose to be. [import]uid: 218976 topic_id: 35950 reply_id: 143185[/import]

At a minimum storyboard scene would include this code:

local storyboard = require( "storyboard" )  
local scene = storyboard.newScene()  
function scene:createScene( event )  
 local group = self.view  
  
 -- create your scene here, add your background here, your buttons  
 -- any other display things you want storyboard to move in and out  
 -- of your scene  
 --  
 -- any display object you create should be inserted into group. self.view is a display.newGroup  
 -- i.e.  
 -- background = display.newImageRect("background.png",570,360)  
 -- group:insert(background)  
 --  
 -- If you don't put it into "group", storyboard WILL NOT manage it.  
end  
  
function scene:enterScene( event )  
 local group = self.view  
  
 -- put things in here like starting Runtime listeners, starting animations and timers  
end  
  
function scene:exitScene( event )  
 local group = self.view  
  
 -- stop anything you started in enterScene  
  
end  
  
function scene:destroyScene( event )  
 local group = self.view  
  
 -- you generally don't need to do much here if you put everything in "group" in   
 -- create scene. This might be a good place to dispose of audio loaded in createScene  
end  
  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
  
return scene  

Take a look at the above as your minimum template. [import]uid: 199310 topic_id: 35950 reply_id: 143256[/import]

Thank you for the help [import]uid: 218976 topic_id: 35950 reply_id: 143734[/import]