Solved

how to calculate the mouse speed?

Posted on 2003-11-27
3
728 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
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 75 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now