Hi all,
I have an error that is rather sporadic. I noticed it in an app that I making that is using OOP so I though it might be related to that, however I have made a smaller file with only two scenes and nothing extra to see if I could recreate the problem and it still occurs. Sometime the error happens after 5 clicks back and forth, sometimes it takes 20 or more. I get a Mac dialogue box saying that “Corona Simulator Quit unexpectedly” - click reopen to open the application again - there is a heap of details but I don’t know if it is relavant or not. After playing around some more I have noticed that if I take the images out of the button in ‘storyboard2.lua’ then it does not happen… Is this a problem with my code, or a corona issue? Just want to know if I need to worry or not. Here is a copy of my code if anyone wants to see of they can recreate the issue.
Main.lua
[lua]
local storyboard = require(“storyboard”);–Include the storyboard library
storyboard.inspectionID = “”
– load first scene
storyboard.gotoScene(“storyboard1”);
[/lua]
storyboard1.lua
[lua]
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local widget = require(“widget”);
display.setStatusBar(display.HiddenStatusBar )
function scene:createScene( event )
local group = self.view
local bg = display.newRect( group, 0, 0, display.contentWidth, display.contentHeight )
bg:setFillColor ( 197, 197, 197 )
------ TITLE BAR
local titleBar = display.newImage(group, “navBar.png”)
local titleText = display.newEmbossedText( group,“Menu 1”, 0, 0, font, 22)
titleText:setReferencePoint( display.CenterReferencePoint )
titleText:setTextColor( 255 )
titleText.x = display.contentWidth * 0.5
titleText.y = titleBar.contentHeight * 0.5
local myButton = widget.newButton
{
left = 100,
top = 200,
width = 150,
height = 50,
id = “button_1”,
label = “Button”,
onEvent = function (event)
storyboard.gotoScene(“storyboard2”, {effect = “slideRight”, time = 300})
end,
}
group:insert( myButton )
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
local lastScene = storyboard.getPrevious()
if(lastScene) then
storyboard.purgeScene( lastScene )
end
end
function scene:exitScene( event )
local group = self.view
end
function scene:destroyScene( event )
local group = self.view
end
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )
return scene
[/lua]
storyboard2.lua
[lua]
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local widget = require(“widget”);
display.setStatusBar(display.HiddenStatusBar )
function scene:createScene( event )
local group = self.view
local bg = display.newRect( group, 0, 0, display.contentWidth, display.contentHeight )
bg:setFillColor ( 197, 197, 197 )
------ TITLE BAR
local titleBar = display.newImage(group, “navBar.png”)
local titleText = display.newEmbossedText( group,“Menu 2”, 0, 0, font, 22)
titleText:setReferencePoint( display.CenterReferencePoint )
titleText:setTextColor( 255 )
titleText.x = display.contentWidth * 0.5
titleText.y = titleBar.contentHeight * 0.5
local myButton = widget.newButton
{
left = 100,
top = 200,
width = 50,
height = 30,
id = “button_1”,
–label = “Button”,
defaultFile = “backButton.png”, --if I comment out these then I dont seem to get the error
overFile = “backButton_over.png”,
onEvent = function (event)
storyboard.gotoScene(“storyboard1”, {effect = “slideLeft”, time = 300})
end,
}
group:insert( myButton )
end
function scene:enterScene( event )
local group = self.view
local lastScene = storyboard.getPrevious()
if(lastScene) then
storyboard.purgeScene( lastScene )
end
end
function scene:exitScene( event )
local group = self.view
end
function scene:destroyScene( event )
local group = self.view
end
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )
scene:addEventListener( “destroyScene”, scene )
return scene
[/lua] [import]uid: 184705 topic_id: 37332 reply_id: 67332[/import]