Error reloading scene in storyload

I have been trying to reload a scene on the game I am creating, and I am runinng into problems. I have been following the tutorial on http://coronalabs.com/blog/2013/08/20/tutorial-reloading-storyboard-scenes/ and I still can’t figure it out. Here is my code from play.lua (the scene that gets reloaded)

[lua]

local function buttonHit(event)

local goto = event.target.gotoScene

storyboard.gotoScene ( goto, { effect = defaultTransition } )

return true

end

local function restart()

local playAgain = makeTextButton(“Play Again”, screenLeft + 40, screenTop + 15, {listener=buttonHit, group=group})

playAgain:setReferencePoint(display.CenterRightReferencePoint)

playAgain.y = (highScore.y + totalMoney.y)/2

playAgain.x = display.contentWidth-20

playAgain:setFillColor(0,0,0)

group:insert(playAgain)

playAgain.gotoScene = “redirect”

end

[/lua]

The code then transitions to “redirect.lua”

[lua]

local storyboard = require( “storyboard” )

local scene = storyboard.newScene()

local score = 0

local scoreTxt

local scoreX = screenRight - 100

local mRandom = math.random

local function restartLevel( target )

storyboard.removeScene(“play”)

storyboard.gotoScene(“play”, { time = 250, effect = “crossfade”} )

end

function scene:createScene( event )

group = self.view

– CREATE display objects and add them to ‘group’ here.

–displayBackground(group)

bg = display.newImageRect(“game_background.png”,2012,1403)

group:insert(bg)

scoreTxt = display.newText( “0”, 0, 0, native.systemFont, 18 )

scoreTxt:setReferencePoint(display.TopRightReferencePoint)

scoreTxt.x = scoreX+80

scoreTxt.y = screenTop + 5

group:insert(scoreTxt)

moneyTxt = display.newText( “0c”, 0, 0, native.systemFont, 18 )

moneyTxt:setReferencePoint(display.TopRightReferencePoint)

moneyTxt.x = scoreX+80

moneyTxt.y = screenTop + 32

group:insert(moneyTxt)

local ground2 = display.newImageRect(“game_ground.png”,4061,81)

ground2.y = display.contentHeight

ground2.x = ground2.x -5

physics.addBody(ground2, “static”, { } )

group:insert(ground2)

local ground = display.newImageRect(“game_ground.png”,4061,81)

ground.y = display.contentHeight-20

ground.x = ground.x -5

group:insert(ground)

player = display.newImageRect(“game_player.png”,67,67)

player.x = display.contentWidth - 25

player.y = ground2.y - 61

player:scale(.63,.63)

group:insert(player)

loadText = display.newText(“Restarting”,0,0,native.systemFont,32)

loadText:setFillColor(255,255,255)

loadText.x = display.contentCenterX

loadText.y = display.contentCenterY

group:insert(loadText)

end

function scene:enterScene( event )

local group = self.view

loadText.alpha = 1.0

transition.to(loadText, { time = 500, alpha = 0, onComplete = restartLevel } )

end

function scene:exitScene( event )

local group = self.view

end

function scene:destroyScene( event )

end

scene:addEventListener( “createScene”, scene )

scene:addEventListener( “enterScene”, scene )

scene:addEventListener( “exitScene”, scene )

scene:addEventListener( “destroyScene”, scene )

return scene

[/lua]

This code runs all the and displays the “restarting” animation but  then I get an error (See attachments)

How do I fix this error? Thank you.

Can you post your redirect.lua?  What is going on at line 11 in that module?  You’re trying to access some .from attribute that doesn’t exist.

My redirect.lua is the second chunk of code that I posted ( under “The code then transitions to “redirect.lua”” ).

Where is defaultTransition defined?

Rob

I think I have solved the problem. I have defaultTransition defined in my main.lua, so that wasn’t the problem. In redirect.lua  I noticed my transition was “crossfade” and not “crossFade”, and that seemed to be what was causes the error. Thank you for you help.

Can you post your redirect.lua?  What is going on at line 11 in that module?  You’re trying to access some .from attribute that doesn’t exist.

My redirect.lua is the second chunk of code that I posted ( under “The code then transitions to “redirect.lua”” ).

Where is defaultTransition defined?

Rob

I think I have solved the problem. I have defaultTransition defined in my main.lua, so that wasn’t the problem. In redirect.lua  I noticed my transition was “crossfade” and not “crossFade”, and that seemed to be what was causes the error. Thank you for you help.