[F8] As mouse gets closer MC1._alpha++
Hi,
I wanted to do this with multiple movie clips, but its reacting opposite to what i want at this time. The alpha is getting near to 0 as mouse gets closer. But it should be getting closer to 100. Also how do I go about doing this with multiple MC?
PHP Code:
function findDist ( mc1 : MovieClip ): Number { var dx : Number = mc2 . _x - _xmouse ; var dy : Number = mc2 . _y - _ymouse ; return ( Math . round (( dx * dx + dy * dy )/ 1000 )); } this . onEnterFrame = function() { findDist ; trace ( findDist ( mc1 )); mc2 . _alpha = ( findDist ( mc1 )); };
Appreciate much!
Sunny
Attached Files
Have fun with it... LMAO, I'm sooo lazy. I'm still workin on reversed alpha effect, I didn't notice that in your post =/.
Edit::::::::::::::
Alright....
Code:
function findDist(clip:MovieClip):Number {
var xdist:Number = _xmouse - clip._x;
var ydist:Number = _ymouse - clip._y;
var distancefromthis:Number = Math.round(Math.sqrt((xdist*xdist) + (ydist*ydist)));
return (100 - distancefromthis) + 20;
}
for(i=1;i<=2;i++){
trace("mc" + i);
eval("mc" + i).onEnterFrame = function() {
trace(findDist(this));
this._alpha = findDist(this);
};
}
I used: http://www.kirupa.com/developer/acti..._distance2.htm
because I was baffled as to why it was doing what it did. =/
Attached Files
Last edited by LifeToTake; 05-17-2008 at 06:38 AM .
Thanks for that, you solved one part of the problem though.
Anyone else wanna take a shot at this?
ummm, dude, that fixes both of your problems?
1: The alpha is getting near to 0 as mouse gets closer. But it should be getting closer to 100.
2: Also how do I go about doing this with multiple MC?
Look at the code in my post.... and the link... I edited my post because I noticed the file that I uploaded only fixed 1 problem.....
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width