Hi Rob, I stripped my app down to the first two lua files and took every other file out of my project folder. The splash screen still flickers (my iPad lies on my desk slightly tilted up by the roll-up smart cover)
Below is the code of the main.lua and the first 29 lines of my splash.lua file. Could the culprit be my onOrientationChange function? But why does it flicker in landscape mode yet not in portrait mode?
main.lua:
[LUA]
local storyboard = require(“storyboard”)
require “sqlite3”
– hide the status bar
display.setStatusBar(display.TranslucentStatusBar)
local background = display.newImage(“mountainsPL.png”)
background.y = display.actualContentHeight/2 + display.topStatusBarContentHeight/2
local display_stage = display.getCurrentStage()
display_stage:insert( background )
display_stage:insert( storyboard.stage )
– set up database and the two tables (flight and legs)
local dbPath = system.pathForFile( “fo.sqlite”, system.DocumentsDirectory )
db = sqlite3.open( dbPath )
– setup flight table if it doesn’t exist
local flightTableSetup = “CREATE TABLE IF NOT EXISTS flight (id INTEGER PRIMARY KEY, flightNumber VARCHAR(30), flightDate VARCHARS(10), aircraft CHAR(10), signIn CHAR(4), signOut CHAR(4), rules CHAR(3), UNIQUE (flightNumber));”
db:exec( flightTableSetup )
local legTableSetup = “CREATE TABLE IF NOT EXISTS leg ( flightId INTEGER, legNumber TINYINT, airportDept CHAR(4), airportArr CHAR(4), timeOut CHAR(4), timeOff CHAR(4), timeOn CHAR(4), timeIn CHAR(4), oil TINYINT, fuelRelease SMALLINT, fuelOff SMALLINT, fuelLanding SMALLINT, pilot1 VARCHAR(75), pilot2 VARCHAR(75), pilot3 VARCHAR(75), pax TEXT, UNIQUE(legNumber) );”
db:exec( legTableSetup )
local passengerTableSetup = “CREATE TABLE IF NOT EXISTS passengers ( aircraft CHAR(10), fname VARCHAR(70), lname VARCHAR(70), nationality(12), passpor VARCHAR(20), passport_exp VARCAHR(15), dob DATE, address VARCHAR(100), city VARCHAR(25), state VARCHAR(25), country VARCHAR(25), phone VARCHAR(25), visa_exp DATE);”
db:exec( passengerTableSetup )
local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end
storyboard.gotoScene(“splash”)
[/LUA]
splash.lua:
[LUA]
local storyboard = require “storyboard”
local scene = storyboard.newScene()
– forward declarations
local group
function scene:createScene( event )
group = self.view
local function onOrientationChange( event )
local currentOrientation = event.type
print( "Current orientation: " … currentOrientation )
storyboard.reloadScene()
end
Runtime:addEventListener( “orientation”, onOrientationChange )
local splashImage, startButtonTop, infoBoxY
if system.orientation == “portrait” or system.orientation == “portraitUpsideDown” then
splashImage = “Default-Portrait.png”
startButtonTop = 915
infoBoxY = 544
else
splashImage = “Default-Landscape.png”
startButtonTop = 653
infoBoxY = 495
end
local splash = display.newImage(group, splashImage)
…
[/LUA]
I appreciate your help in this!
Leonardo