App on simulator works great, on device not

hey. this code works great on the simulator (every device) but if i load it on my s4, the startbutton is not display.

centerX, centerY = display.contentCenterX, display.contentCenterY screenX, screenY = display.screenOriginX, display.screenOriginY screenWidth, screenHeight = display.contentWidth - screenX \* 2, display.contentHeight - screenY \* 2 display.setStatusBar ( display.HiddenStatusBar ) display.setDefault(anchorX) display.setDefault(anchorY) local screenW, screenH, halfW, halfH = display.contentWidth, display.contentHeight, display.contentWidth/2, display.contentHeight/2 \_H = display.contentHeight; \_W = display.contentWidth; local centerX = display.contentCenterX local centerY = display.contentCenterY math.randomseed( os.time() ) local colorBalls = { "flieder", "Blue", "Red", "Yellow", "mint", "rosa", "Green", "hellorange" } local newSeq = {} local mainBalls = {} local numBalls = 2 -- how many in the sequence? local sequenceIdx = 1 local anzDraws = {} local BOOP\_PAUSE = 1000 local GAME\_STATE = "waiting" local LoserSound = audio.loadSound("audio/Loser.aiff") local WinnerSound = audio.loadSound("audio/Winner.aiff") local resetGame -- forward reference for a function below -- display the option to start the game or reset after a win/loss local g = display.newGroup() local bg = display.newImage("images/bg.png") bg.x = screenWidth/2 bg.y = screenHeight/2 g:insert(bg) local logos = display.newImageRect("images/logo.png",25, 25) logos.x = \_W-80 logos.y = 35 logos.alpha = 0.7 local logodisp = display.newImage("images/logo2.png") logodisp.x = 210 logodisp.y = 50 logodisp.xScale = 0.5 logodisp.yScale = 0.5 logodisp.alpha = 0.5 local score = {} score = 0 local scoretxt = display.newText(""..score,0,0,native.systemFontBold,30) scoretxt.x = \_W-130 scoretxt.y = 35 scoretxt:setTextColor(255, 255, 255) scoretxt.alpha = 0.5 --end local function showReset(obj) local function resetTouched(e) if e.phase == "ended" then if obj ~= nil then transition.fadeOut(obj, {time=500, onComplete=function() display.remove(obj) end }) end e.target:removeEventListener ( "touch", resetTouched ) e.target:removeSelf() resetGame() resetGame() end end local resetText = display.newImage("/images/go.png") -- resetText:setFillColor(0, 0, 0) resetText.alpha = 0.9 resetText.x = centerX resetText.y = centerY + 350 resetText.xScale = 0.4 resetText.yScale = 0.4 g:insert(resetText) resetText:addEventListener ( "touch", resetTouched ) end -- make the chosen ball expand/contract and brighten/dim local function popBall(b) local function unPop(b) transition.to ( b, { time=500, xScale = 1, yScale = 1, alpha = 0.6, rotation=0 } ) end transition.to ( b, { time=200, xScale = 0.7, yScale = 0.7, alpha = 1, rotation=-55, onComplete=unPop} ) -- audio.play ( b.sound ) end -- for the computer's turn, walk through newSeq one at a time local function playSequence() popBall(mainBalls[newSeq[sequenceIdx]]) if sequenceIdx \< #newSeq then timer.performWithDelay( BOOP\_PAUSE, playSequence ) else GAME\_STATE = "playing" sequenceIdx = 0 -- reset the idx so we can see if the player does it right local yourTurn = display.newImage( "/images/you.png") yourTurn.x = centerX yourTurn.y = centerY + 350 yourTurn.xScale = 0.5 yourTurn.yScale = 0.5 transition.fadeIn(yourTurn, {time=100,delay=800, onComplete=function() transition.fadeOut(yourTurn, {time=2000}) end }) end sequenceIdx = sequenceIdx + 1 end -- create a new random sequence for each new game. local function createSequence(numColors) local sequence = {} for i = 1, numColors do sequence[#sequence+1] = colorBalls[math.random(1, #colorBalls)] end return sequence end -- after a win or loss we need to reset some things to play again. function resetGame() sequenceIdx = 1 newSeq = createSequence(numBalls) numBalls = numBalls + 1 timer.performWithDelay( 200, playSequence ) end -- for the user's turn we watch for win/loss conditions when user touches a ball local function ballTouched(e) if e.phase == "ended" then -- if we're not in "playing" mode just ignore the touches if GAME\_STATE ~= "playing" then return end popBall(e.target) -- see if the color we touched is the same as the next color in the sequence if newSeq[sequenceIdx] == e.target.color then local star = display.newImage("images/yes.png") star.x = e.target.x star.y = e.target.y transition.fadeOut(star, {time=2000, y= e.target.y-100,onComplete=function() display.remove(star) end }) sequenceIdx = sequenceIdx + 1 -- check and see if we're done here with a win score = score +1 scoretxt.text = "" .. score local bgcols2 = { "1", "2", "3", "4", "5", "6", "7", "8" } local bgcols = {"9"} local bgcol = bgcols[math.random(#bgcols)] bgss = display.newImage("images/" .. bgcol .. ".png") bgss.x = \_W/2 bgss.y = \_H/2 bgss.alpha = 0.5 bgss.blendMode = "add" tbgss = transition.to(bgss, {time = 600, delay = 200, alpha = 0, onComplete = nil;}) local sheetData1 = { width=243, height=197, numFrames=24, sheetContentWidth=5844, sheetContentHeight=197 } local sheet1 = graphics.newImageSheet( "effect2.png", sheetData1 ) local sequenceData = { { name="seq1", sheet=sheet1, start=1, count=24, time=600, loopCount=1 } } local myAnimation = display.newSprite( sheet1, sequenceData ) myAnimation.x = e.target.x myAnimation.y = e.target.y myAnimation.alpha = 0.9 myAnimation.rotation = math.random(360) myAnimation.blendMode = "add" myAnimation:play() local anitrans = transition.to(myAnimation, {time = 200, delay = 500, alpha = 0}) if sequenceIdx \> #newSeq then GAME\_STATE = "won" audio.play ( WinnerSound ) local youWon = display.newImage( "/images/jes.png", centerX, centerY-250) youWon.xScale = 0.6 youWon.yScale = 0.6 --youWon:setFillColor(0.7, 1, 0.7, 0.5) showReset(youWon) end else local ex = display.newImage("images/no.png") ex.x = e.target.x ex.y = e.target.y local bgcols2 = {"10"} local bgcol2 = bgcols2[math.random(#bgcols2)] bgss2 = display.newImage("images/" .. bgcol2 .. ".png") bgss2.x = \_W/2 bgss2.y = \_H/2 bgss2.alpha = 0.4 bgss2.blendMode = "add" tbgss2 = transition.to(bgss2, {time = 600, delay = 200, alpha = 0, onComplete = nil;}) transition.fadeOut(ex, {time=3000, y = e.target.y-150, onComplete=function() display.remove(obj) end }) GAME\_STATE = "lost" audio.play ( LoserSound ) local youLost = display.newImage( "images/wrong.png", centerX, centerY-250) youLost.xScale = 0.4 youLost.yScale = 0.4 showReset(youLost) end end end -- display the four balls on the screen and tweak their parameters local function setUpBalls() local count = 1 for i = 1, 4 do for j = 1, 2 do local idx = colorBalls[count] mainBalls[idx] = display.newImage("images/" .. colorBalls[count] .. ".png") mainBalls[idx].height = 110 mainBalls[idx].width = 110 mainBalls[idx].x = (( \_W/2)/4+55) \*(i-0.1) mainBalls[idx].y =(( \_H/2)/4+20) \*(j+2) mainBalls[idx].alpha = 0.6 mainBalls[idx].color = colorBalls[count] mainBalls[idx].sound = audio.loadSound("audio/" .. colorBalls[count] .. ".aiff") mainBalls[idx]:addEventListener ( "touch", ballTouched ) count = count + 1 end end end -- create/display the balls for cheating purposes (to show the sequence on the screen) local function displaySequence() for i=1, #newSeq do print (newSeq[i]) local text = display.newText( newSeq[i], 30, 150 + (20 \* i), "Helvetica", 18 ) end end -- uncomment to cheat! -- displaySequence() setUpBalls() showReset(nil)

the button is this:

local resetText = display.newImage("/images/go.png") -- resetText:setFillColor(0, 0, 0) resetText.alpha = 0.9 resetText.x = centerX resetText.y = centerY + 350 resetText.xScale = 0.4 resetText.yScale = 0.4 g:insert(resetText) resetText:addEventListener ( "touch", resetTouched )

pleas be not irritatet by “resetText” - it should be a image displaying, leading to the start of the game.

Generally when we see “It works in the sim but not the device”, you most likely have a problem with file name case sensitivity.  Perhaps the case on the file name doesn’t match the real file name.

However you wont know what’s going on until you look at your device’s console log.  If you don’t now  how to read your console log please read this tutorial:

http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Thanks

Rob

Generally when we see “It works in the sim but not the device”, you most likely have a problem with file name case sensitivity.  Perhaps the case on the file name doesn’t match the real file name.

However you wont know what’s going on until you look at your device’s console log.  If you don’t now  how to read your console log please read this tutorial:

http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Thanks

Rob