Search Tutorials
This shows how we can calculate the proximity of the Mouse to a MC using Pythagorus Theorem, i.e (X squared) + (Y squared) = (Z squared. Once we know how to calculate the distance, creating cool effects based on proximity is pretty straight forward. Paste this code into your MC and have fun playing with the variables!
onClipEvent (enterFrame) {
//set up the variables
range = 150;
scaleMin = 65;
rotateSpeed = 3;
alphaMin = 25;
//Calculate the proximity of the mouse to the MC
xdif2 = (_xmouse*_xmouse);
ydif2 = (_ymouse*_ymouse);
totdif = Math.sqrt(xdif2+ydif2);
//is proximity of the mouse to the MC within our range?
//If yes calculate the percentage of the range.
if (totdif |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|