Of course I have required the composer, here’s the full code for the scene anyway, it’s pretty annoying I cannot get it fixed…
----------------------------------------------------------------------------------------- -- -- searchScene.lua -- ----------------------------------------------------------------------------------------- local composer = require( "composer" ) local scene = composer.newScene() function searchForNumber() local rect = display.newRect(w, h, display.actualContentWidth, display.actualContentHeight) rect:setFillColor(0.5, 0.5, 0.5) rect.alpha = 1 local phono = getPhoneNumber() or "123123" local searchingText = display.newText("Searching for " .. phono .. ".", w, h, native.systemFont, 16 ) local sLength = phono:len() local dot = true local sText = searchingText.text print(sText) --print(" THIS " .. sText:sub( 16 + tonumber( sLength ) )) local function animateText() if(dot) then searchingText.text = "Searching for " .. phono .. twoDots .. "" dot = false else searchingText.text = "Searching for " .. phono .. oneDot .. "" dot = true end end searchTimer = timer.performWithDelay(500, animateText, -1) local function numberFound() timer.cancel( searchTimer ) searchingText:removeSelf() searchingText = nil local rect = display.newRect(w, h, 300, 250) rect:setFillColor(0.7, 0.7, 0.7) location = "USA, New York" local text = display.newText("Number found!", w, h-100, native.systemFont, 26) local location = display.newText("Location: " .. location .. "", w, h, native.systemFont, 20) local backBtn = display.newRect(w, h+80, 100, 50) local function onBackClick(event) local t = event.target if event.phase == "began" then display.getCurrentStage():setFocus( t ) t.isFocus = true t.yScale = 0.9 t.xScale = 0.9 t.alpha = 0.8 elseif t.isFocus then if event.phase == "ended" then display.getCurrentStage():setFocus( nil ) t.isFocus = false t.yScale = 1 t.xScale = 1 t.alpha = 1 composer.gotoScene("menu") end end end backBtn:addEventListener("touch", onBackClick) end timer.performWithDelay(500 + math.random(400, 500), numberFound) end function scene:create( event ) local sceneGroup = self.view local rect = display.newRect(w, h, display.actualContentWidth, display.actualContentHeight) rect:setFillColor(0.5, 0.5, 0.5) searchForNumber() end -- "scene:show()" function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then elseif ( phase == "did" ) then end end -- "scene:hide()" function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is on screen (but is about to go off screen). -- Insert code here to "pause" the scene. -- Example: stop timers, stop animation, stop audio, etc. elseif ( phase == "did" ) then -- Called immediately after scene goes off screen. end end -- "scene:destroy()" function scene:destroy( event ) local sceneGroup = self.view -- Called prior to the removal of scene's view ("sceneGroup"). -- Insert code here to clean up the scene. -- Example: remove display objects, save state, etc. end -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ------------------------------------------------------------------------------- return scene