How to use mouse event(onmousemove) in Android WebView?

by seri » Fri, 06 Mar 2009 05:19:39 GMT


Sponsored Links
 On iPhone, This is donw with addtional events
(ontouchmove,ontouchstart,ontouchend)
I know that these are only available in iPhone Safari.

Is There any way to control by touch event(onmousemove)?
How to use mouse event in WebView or Browser ?

-----------------------------------------------------------------------------------------------------
<html>
<head>
<title> Event </title>
<style>
.drag { position: relative; cursor:move }
</style>
<script language="JavaScript">
<!--
var bdown = false;
var x, y;
var sElem;

function mdown() {
 if(event.srcElement.className == "drag") {
  bdown = true;
  sElem = event.srcElement;
  x = event.clientX;
  y = event.clientY;
 }
}
function mup() {
 bdown = false;
}
function moveimg() {

 if(bdown)
 {

  var distX = event.clientX - x;
  var distY = event.clientY - y;
  sElem.style.pixelLeft += distX;
  sElem.style.pixelTop += distY;
  x = event.clientX;
  y = event.clientY;

 return false;
 }
}

document.onmousedown  = mdown;
document.onmouseup  = mup;
document.onmousemove  = moveimg;

//-->
</script>
</head>

<body>


<img src=" http://farm1.static.flickr.com/52/157145833_958fb267a2.jpg? 
v=0" class="drag">

</body>
</html>


--~--~---------~--~----~------------~-------~--~----~



How to use mouse event(onmousemove) in Android WebView?

by seri » Fri, 06 Mar 2009 05:19:44 GMT


 On iPhone, This is done with new additional events
(ontouchmove,ontouchstart,ontouchstart).
I know that these are not available in Android.

How can I use mouse event(onmousemove) in Android WebView or Browser?

-----------------------------------------------------------------------------------------
<html>
<head>
<title> New Document </title>
<style>
.drag { position: relative; cursor:move }
</style>
<script language="JavaScript">
<!--
var bdown = false;
var x, y;
var sElem;

function mdown() {
 if(event.srcElement.className == "drag") {
  bdown = true;
  sElem = event.srcElement;
  x = event.clientX;
  y = event.clientY;
 }
}
function mup() {
 bdown = false;
}
function moveimg() {

 if(bdown)
 {

  var distX = event.clientX - x;
  var distY = event.clientY - y;
  sElem.style.pixelLeft += distX;
  sElem.style.pixelTop += distY;
  x = event.clientX;
  y = event.clientY;

 return false;
 }
}



document.onmousedown  = mdown;
document.onmouseup  = mup;
document.onmousemove  = moveimg;

//-->
</script>
</head>

<body>


<img src=" http://farm1.static.flickr.com/52/157145833_958fb267a2.jpg? 
v=0" class="drag">

</body>
</html>


--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Freescale iMX27

Is anyone working on an iMX27/37 Android port?

Thanks,
J
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 

2. About Analysis of Bionic libc

Hi All,
           i want to analyse the basic dependencies which are required
to analyse to actually port android on some embedded platform? e.g its
support to networking,file system its POSIX compliance ,and all the
other dependencies which are really need to taken in to consideration
while porting bionic libc on to some different embedded paltform.


Regards,
DJ
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 

3. OutOfMemoryError when switching orientation

4. How to show detailed build information when build one component of Android source codes

5. kSoap2 for Android

6. Music file format supported by Android

7. DalvikVM VFY: Unable to resolve static method 122