Possible native.newWebView:back() and :forward() issues...

The community has been great so far, and the dev team working on the issues that came up before for native.newWebView has been quick to react. Thanks so far.

Another issue seem to have cropped up. When I use my forward and back buttons they don’t just go one page at a time. They go to the very beginning or very end of the pages visited.

Here’s my code. Hopefully someone can tell me what I may be doing wrong, or if it’s an issue that the corona team can work on.

  
 local webView = native.newWebView( 0, 0, 320,436)  
 webView:request( "http://www.coronasdk.com/" )  
  
 local bottomBar = display.newImage("blankBackBar.png", 320, 43)  
 bottomAd:setReferencePoint(display.CenterReferencePoint)  
 bottomAd.x = display.contentWidth /2  
 bottomAd.y = display.contentHeight /2 +218  
  
 local homeIcon = display.newImage("home.png", 30, 30)  
 homeIcon:setReferencePoint(display.CenterReferencePoint)  
 homeIcon.x = display.contentWidth /2  
 homeIcon.y = display.contentHeight /2 +216  
 homeIcon.scene = "first\_page"  
  
 local goBack = display.newImage("leftArrow.png", 48, 30)  
 goBack.x = display.contentWidth /2 - 120  
 goBack.y = display.contentHeight /2 +216  
  
 local goForward = display.newImage("rightArrow.png", 48, 30)  
 goForward.x = display.contentWidth /2 +120  
 goForward.y = display.contentHeight /2 +216  
  
  
 function changeScene(e)  
 if(e.phase == "ended") then  
 director:changeScene(e.target.scene)  
 end  
 end  
  
  
 local function backTap()  
 webView:back()  
 end  
  
 local function forwardTap()  
 webView:forward()  
 end  
  
  
 localGroup:insert(bottomBar)  
 localGroup:insert(homeIcon)  
 localGroup:insert(webView)  
 localGroup:insert(goForward)  
 localGroup:insert(goBack)  
  
  
 homeIcon:addEventListener("touch", changeScene)  
 goBack:addEventListener("touch", backTap)  
 goForward:addEventListener("touch", forwardTap)  

[import]uid: 7710 topic_id: 22092 reply_id: 322092[/import]

You appear to be using “touch” without specifying event.phase, so the function is firing twice each tap.

Why not use “tap” instead of “touch”, or specify an event.phase, so it only fires once?

Let me know if that resolves this issue or if it still seems to persist despite only calling the function once.

Peach :slight_smile: [import]uid: 52491 topic_id: 22092 reply_id: 87813[/import]

Peach-

Thanks so much! That fixed the issue I was having.
Just getting going with Corona, and getting use to Lua. The help I get in the forums has been great. [import]uid: 7710 topic_id: 22092 reply_id: 87817[/import]

Heh, no worries - it’s a very easy mistake to make. (I only knew what it was because I used to do that myself with alarming frequency.)

:wink: [import]uid: 52491 topic_id: 22092 reply_id: 87986[/import]