Hi, I’m doing a trivia game and I’m using mod_parse to communicate to my server, the problem is that each time I answer a question I send info to the server about my lifes,score,etc. and sometimes when internet connection become slow my screen becomes black so look like an error.
I have added a 10seconds timeout to the mod_parse in the network.request , how can I avoid that black screen this is an example of how is my answer scene.
Should my server connection be in “will show” or “did show” or I must destroy the scene and put it on the “create”
local composer = require( "composer" ) local scene = composer.newScene() function scene:create( event ) local group = self.view --Create UI end function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then --fill info for view elseif ( phase == "did" ) then --start music, timers if myApp.userPreferences.facebook\_connect==true then local conection=userOperations.checkConnection() if conection==true then pcall(function() --Send data to server end) pcall(function() --Send other data to server end); end end end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then --stop timers,music elseif ( phase == "did" ) then -- remove and dispose end end function scene:destroy( event ) local sceneGroup = self.view sceneGroup:removeSelf( ) sceneGroup=nil end scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) return scene