# Help with BLUR

**URL:** <https://forum.kirupa.com/t/help-with-blur/177162>\
**Category:** flash\
**Created:** [January 30, 2006, 8:01pm UTC](https://forum.kirupa.com/t/help-with-blur/177162 "2006-01-30T20:01:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericlarson007](https://avatars.discourse-cdn.com/v4/letter/e/0ea827/32.png) [@ericlarson007](https://forum.kirupa.com/u/ericlarson007)\
**Post date:** [January 30, 2006, 8:01pm UTC](https://forum.kirupa.com/t/help-with-blur/177162/1 "2006-01-30T20:01:01Z")

</div>

I’m trying to get a Depth of Field Effect, the closer the mouse is to the movie clip the less blur there is.

I’ve got proximity scale and a rollover blur but haven’t been able to put them both together. Here they are hope some one can help with a Proximity\_Blur.

PROXIMITY\_SCALE

function proximity(circle) {  
var x:Number = \_root.\_xmouse;  
var y:Number = \_root.\_ymouse;  
var cx:Number = circle.\_x;  
var cy:Number = circle.\_y;  
var prox:Number = Math.sqrt((x-cx)_(x-cx) + (y-cy)_(y-cy));  
if(prox\<100) {  
circle.\_xscale = 200 - prox;  
circle.\_yscale = circle.\_xscale;  
}  
else {  
circle.\_xscale = 100;  
circle.\_yscale = circle.\_xscale;  
}  
}  
this.onEnterFrame = function() {  
proximity(circle);  
}

circle.onRollOver = dukes.onRollOver = magnum.onRollOver = function() {  
this.swapDepths(\_root.getNextHighestDepth());  
}

Here is the ROLLOVER\_BLUR

import flash.filters.BlurFilter;  
var gf:BlurFilter = new BlurFilter(20,20,3);  
s.filters = [gf];  
s.onRollOver = function() {  
this.onEnterFrame = function() {  
if (gf.blurX \> 1) {  
gf.blurX–;  
gf.blurY–;  
} else {  
delete this.onEnterFrame;  
}  
this.filters = [gf];  
};  
};  
s.onRollOut = function() {  
this.onEnterFrame = function() {  
this.filters = [gf];  
if (gf.blurX \< 20) {  
gf.blurX++;  
gf.blurY++;  
} else {  
delete this.onEnterFrame;  
}  
};  
};
