hi! i’m pretty new at actionscript. struggling actually… so thanks for all your help in advance
I need help with a time function with an onMouseMove function.
I want to be able to do a couple of things:
The movie clip must be globally be able to calculate,
if the distance from _x position of the mouse to another _x position of the mouse is say (for example) less than 20 pixels, and the time to achieve less than 20 pixels is less than 2 second,
then go to and play an external movie clip (which must be absolutely positioned at a specific cooridinates.
I am planning to have like 3 similar movie clips detecting different distances calculations and time, so that each will go and play different movie clips for different specifications.
I dont know where getTimer() gets into this but i have a very deep feeling it does :cyclops:
Interesting. I hadn’t thought that there was an aplication for that, but that is the beuty of Flash after all. With so many people, there are always more ideas poping up.
well, getTimer(); gets the number of miliseconds since the start of the movie. We can set variables to equal it at any time.
I’m just taking guesses right now… but here are some things to look at
onClipEvent (load){
//I just threw this in to show dynamic naming potencial
clipName="theNameOfMyMovieClip";
//these allow control of the parameters more easily
timeRequired=2;
distanceRequired=20;
trip=false;
function initiate(){
t1=getTimer();
mx1=_root._xmouse;
my1=_root._ymouse;
trip=true;
}
funtion test(){
t=t2-t1;
lQ= (mx1 mx2 my1 my2);
if(t<timeRequired&&lQ>distanceRequired){
_root[clipName].play();
}
}
}
onClipEvent (enterFrame) {
if(trip){
t2=getTimer();
mx2=_root._xmouse;
my2=_root._ymouse;
test();
}
}
NOT DONE**
I’m still working on the final mathmatics for this code, so this is not done. Just an outline for me to work off of. I have to get the math from my home comp. (stupid brain!)