Skip to main content
Inspiring
April 30, 2012
Question

WebView - Fake TouchScreen [HELP]

  • April 30, 2012
  • 1 reply
  • 853 views

I'm working on an AIR app for an HP Touchscreen... we have a section that loads a webview.

The problem is that an HP Touchscreen doesnt use true touch .. its infared touch. Which basically is the same as a mouse except it uses infared to determine where your finger is.

The problem this poses is that my webviews contain a scrollbar and you cannot scroll with your finger.  Very annoying!

Is there any way to use a stage listener or something and scroll the webview window when you user drags up or down ?

This topic has been closed for replies.

1 reply

sinious
Legend
April 30, 2012

The webview is a standard webpage. At that point you're going to need to use some JavaScript but it won't be easy if you have anything on the page the user can click to interact with. If not then much the same way with ActionScript, you'd add an event listener for mouse down in javascript, note the mouses Y position and as the user drags up or down you'd scroll the page (with javascript) that amount.

Most of the JavaScript methods to do so are very similar to ActionScript. Or you can look into the http://www.jquery.com jquery plugin to help you do some of this in a sexy and smooth way with their animation capabilities.

For it to work either way you'd need to know if mouse clicks are even entering the HTML page. Add a mouse click to the body and just toss up an alert("it works!"); just to make sure for some reason it's not receiving events.

Here's tons of examples of page scrolling with javascript:

https://www.google.com/search?rlz=1C1AFAB_enUS441US441&sourceid=chrome&ie=UTF-8&q=scroll+page+with+javascript

Applauz78Author
Inspiring
May 1, 2012

But the pages I'm loading in are not pages I have control over.  ie/ Facebook, etc.

sinious
Legend
May 1, 2012

StageWebView goes over the entire flash piece. That means you can't even trap events on any part of the stage. You, sir, cannot do what you want.

The only alternative is to implement your OWN scrollbar. The scroll position is accessible and alterable. Although probably not with the smoothness you expected in just dragging up/down in the view.