PDA

View Full Version : Blur during runtime


Frosty_spl
06-29-2006, 10:28 PM
Hey guys,

Im having problems making the flash 8 blur effect occur during runtime using AS. I want the background of our site to work the same way as www.redbullracing.com, where you rollover a text box and the BG blurs, but if you roll onto the BG, it will sharpen. Also having no hand pointer when you rollover.

I found some code online, but it dosent seem to work. I also have to create an array using bg1 - bg5 for my bg movieclips, and im not too sure how to do that.


my code... (i placed it on its own layer on frame of the timeline, if I tried to include it into another actions layer, some of the other code wouldn't work) This code would work when it was in a test file I made, but when i put it into my project, it wouldnt.
import flash.filters.BlurFilter;
var blurFilter:BlurFilter = new flash.filters.BlurFilter();
var filterArray:Array = [];
filterArray.push(blurFilter);

_root.bg1.onRollOut = function() {
this.onEnterFrame = function() {
blurFilter.blurX += 1;
// increases the blur in steps of 5
blurFilter.blurY += 1;
this.filters = filterArray;
if (blurFilter.blurY>=5) {
// 40 is the max amount you want things to blur
delete (this.onEnterFrame);
}
};
};
_root.bg1.onRollOver = function() {
this.onEnterFrame = function() {
blurFilter.blurX -= 1;
// decrease the blur in steps of 5
blurFilter.blurY -= 1;
this.filters = filterArray;
if (blurFilter.blurY<=0) {
// when it hits 0, its no longer blurred...therfore stop bluring
delete (this.onEnterFrame);
}
};
};



Thanks alot!
Clint