Webview

Hi, I need help with WebView. I notice that it does not accept scaling so there any other way I could position the WebView to fit part of the screen? Below is my code:

local webView = native.newWebView(display.contentCenterX, display.contentCenterY, 320, 480 )

webView:request( “http://www.ptsd.va.gov/public/ptsd-overview/basics/how-common-is-ptsd.asp” )

the creator function takes and x and y position and also a width and height - just like a rect.  So you can position it anywhere and at any size.

I tried that but it didn’t help…instead it stretch.

That’s what it looked like after

Well obviously your webview is wider than your canvas size  It will depend what scaling method you are using in config.lua.  This covers the basics - https://docs.coronalabs.com/guide/basics/configSettings/index.html

Good morning…I notice that whenever I switch scenes, the webview show too. Is there a way I can stop that from happening? I tried using scenegroup but it came up as an error instead.

You need to destroy the webview when you switch scenes.

Below is the code I have but it didn’t work:(

Function scene:destroy(event)
Local sceneGroup = self.view
webview:removeSelf()
End

the creator function takes and x and y position and also a width and height - just like a rect.  So you can position it anywhere and at any size.

I tried that but it didn’t help…instead it stretch.

That’s what it looked like after

Well obviously your webview is wider than your canvas size  It will depend what scaling method you are using in config.lua.  This covers the basics - https://docs.coronalabs.com/guide/basics/configSettings/index.html

Good morning…I notice that whenever I switch scenes, the webview show too. Is there a way I can stop that from happening? I tried using scenegroup but it came up as an error instead.

You need to destroy the webview when you switch scenes.

Below is the code I have but it didn’t work:(

Function scene:destroy(event)
Local sceneGroup = self.view
webview:removeSelf()
End