webview transittions with scenes

I have a problem that seems to be common and corona STILL hasnt fixed. I have a main menu scene and a webscene that shows a live a website. I can go from the menu screen to the webscene and go back to the menu screen fine. The problem is when I go back to webscene a gain all I get is a blank screen. every other option I tried besides the one below cause a crash or no webpage to appear even once. Please Help thanx :slight_smile:

this is in my createscene of the internet scene:

local function listener( event )     local shouldLoad = true     local url = event.url     if 1 == string.find( url, "corona:close" ) then         -- Close the web popup         shouldLoad = false     end     if event.errorCode then         -- Error loading page         print( "Error: " .. tostring( event.errorMessage ) )         shouldLoad = false     end     return shouldLoad end local options = {     hasBackground = false,     baseUrl = system.DocumentsDirectory,     urlRequest = listener } native.showWebPopup( 20, 45, 430, 270, "https://www.youtube.com/watch?v=rujCyD\_nEdo", options )

and this is in my exitScene:

native.cancelWebPopup()

First, you should probably be using native.newWebView() instead of native.showWebPopup().

Next you probably should be explicitly removing it in scene:hide()'s “will” phase, and creating it new in scene:show()'s did phase.

Rob

Thank you, can you show me an expicit example of how scene:hide()  and scene:show is used? I looked at the documentation and couldn’t find an example

local composer = require( "composer" ) local scene = composer.newScene() local webView function scene:show( event )     local sceneGroup = self.view     if event.phase == "did"  then         webView = native.newWebView( display.contentCenterX, display.contentCenterY - 25, display.contentWidth, display.contentHeight - 50 )         webView:request( "http://someurl.com" )     end end function scene:hide( event )     local sceneGroup = self.view         if event.phase == "will" then             if webView then             webView:removeSelf()             webView = nil         end     end end scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene )

Or something like that.

First, you should probably be using native.newWebView() instead of native.showWebPopup().

Next you probably should be explicitly removing it in scene:hide()'s “will” phase, and creating it new in scene:show()'s did phase.

Rob

Thank you, can you show me an expicit example of how scene:hide()  and scene:show is used? I looked at the documentation and couldn’t find an example

local composer = require( "composer" ) local scene = composer.newScene() local webView function scene:show( event )     local sceneGroup = self.view     if event.phase == "did"  then         webView = native.newWebView( display.contentCenterX, display.contentCenterY - 25, display.contentWidth, display.contentHeight - 50 )         webView:request( "http://someurl.com" )     end end function scene:hide( event )     local sceneGroup = self.view         if event.phase == "will" then             if webView then             webView:removeSelf()             webView = nil         end     end end scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene )

Or something like that.