# Need help with an effect related to distance

**URL:** https://forum.kirupa.com/t/need-help-with-an-effect-related-to-distance/240973
**Category:** Uncategorized
**Created:** [October 9, 2007, 12:08am UTC](https://forum.kirupa.com/t/need-help-with-an-effect-related-to-distance/240973 "2007-10-09T00:08:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![liner986](https://avatars.discourse-cdn.com/v4/letter/l/bbce88/32.png) [@liner986](https://forum.kirupa.com/u/liner986)
#### Post date: [October 9, 2007, 12:08am UTC](https://forum.kirupa.com/t/need-help-with-an-effect-related-to-distance/240973/1 "2007-10-09T00:08:26Z")

</div>

Ive already posted the same thing at the flash 8 section but no one had an answer, so i thought experts in action script might be able to help ;D

erm, I was looking at one of the tutorials for flash to help me get an effect which i wanted for a flash movie which im making. The tutorial is rlly good but the effect that i wanted is a little different.

tutorial: [http://www.kirupa.com/developer/acti…\_distance2.htm](http://www.kirupa.com/developer/actionscript/calculating_distance2.htm)  
the lovely effect: [http://danlod.com/enindex.php](http://danlod.com/enindex.php)  
(note: the subject is the little flash movie which shows/lists the options for different languages)

The tutorial states how to calculate the distance and all that, but i want the objects to get bigger when the pointer gets closer to them instead of changing transparency but as u can see im a true novice with my actionscript skills… can anyone plz show me an example or make a quick 1 line script for me ? ( i think only the last line needs editing)

thnQ

heres the script:

onClipEvent (enterFrame) {  
xdist = Math.round(\_root.\_xmouse - \_parent.\_x);  
ydist = Math.round(\_root.\_ymouse - \_parent.\_y);  
distancefromthis = Math.round(Math.sqrt((xdist_xdist) + (ydist_ydist)));  
\_parent.\_alpha = (100-distancefromthis)+20;  
}
