[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 751
  • Last Modified:

how to calculate the mouse speed?

hi, everyone
 now, i can use actionscript to get mouse x and y position, and i try alot of methods, still can't get the mouse speed. can anyone tell me how to do that?

ps: i want to get mouse speed. so that i can know users move their mouse fast or slow.
0
justice_ong
Asked:
justice_ong
1 Solution
 
OBCTCommented:
First we'll need to know a few things before we can take this any further...
How do you want the mouse speed to be measured?
How do you plan on storing the information?

The only way I could think of doing this is by running a trace on the mouse co-ordinats and by running a timer to calculate the time it takes for the user to move from pixel to pixel, then calculating the average time and have that stored in an online database...

Cheers

-OBCT
0
 
justice_ongAuthor Commented:
ya..i have used timer. but the problem is i always get the result zero..
0
 
negatyveCommented:
try this on a movieclip:

onClipEvent(enterFrame){
      trace(Math.round(Math.abs(_root._xmouse - this.oldx)));
      trace(Math.round(Math.abs(_root._ymouse - this.oldy)));
      this.oldx = _root._xmouse;
      this.oldy = _root._ymouse;
}
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now