Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how to calculate the mouse speed?

Posted on 2003-11-27
3
Medium Priority
?
749 Views
Last Modified: 2007-12-19
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
Comment
Question by:justice_ong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Expert Comment

by:OBCT
ID: 9835423
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
 

Author Comment

by:justice_ong
ID: 9835430
ya..i have used timer. but the problem is i always get the result zero..
0
 
LVL 27

Accepted Solution

by:
negatyve earned 225 total points
ID: 9840800
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question