Hy, i’m really newbie in corona programming.
I’m stuck in a piece of code and i can’t find solution…
i’m trying to redirect to another view if network is down and network.request fails
in SplashScreen.lua i’ve got…
local function networkListener( event )
if ( event.isError ) then
composer.gotoScene( “NetworkError” )
print( “go to Network error view!” )
else
local phase = event.phase;
if (phase == “ended”) then
composer.gotoScene( “NetworkOK” )
print( “go to Network OK view!” )
end
end
end
network.request( “http://www.google.com”, “GET”,networkListener)
end
when i open app with no network it jumps correctly in NetworkError.lua
in NetworkError.lua i’ve a button that reopens SplashScreen.lua to try again network status
sometimes works so NetworkError.lua reopens SplashScreen.lua and (if NO NETWORK) redirect again to NetworkError.lua etc…
but mostly fails… after click on button it opens a black screen…
i attach my code
Thanks in advance to all