Blur Filter Problem ... :(

I have this script and I can’t figure out why it works when I have 7 pictures to scroll between but when I have 12 images it doesn’t work …

Any ideas?

Thanks!

Boon.

 
// Motion Blur slider
//
stop();
import flash.filters.BlurFilter;
//
// Variables
//
var speed:Number = 1.8;
var numButtons:Number = 12;
var blFilter:BlurFilter = new BlurFilter(0, 0, 2);
var imgDist:Number = 305;
//
// Functions
//
function initButtons():Void {
 for (var i = 0; i<numButtons; i++) {
  var btn:MovieClip = this["b"+i];
  btn.targetx = -(i*imgDist);
  btn.onRelease = function() {
   blurTo(slider_mc.images_mc, this.targetx);
  };
 }
}
function blurTo(mc:MovieClip, tx:Number):Void {
 // common ease equation
 mc.onEnterFrame = function() {
  var dx:Number = tx-this._x;
  var blurAmount:Number = Math.abs(dx);
  blFilter.blurX = blurAmount;
  this.filters = [blFilter];
  var movex:Number = dx/speed;
  this._x += movex;
  if (Math.abs(this._x-tx)<1) {
   delete this.onEnterFrame;
   this.filters = null;
   this._x = tx;
  }
 };
}
//
// Begin
//
initButtons();

[COLOR=magenta]Here[/COLOR] is the .fla

It worked for me just fine. Was there something else it was suppose to do besides scroll to an image? :ponder:

Yeah it’s supposed to blur … while it goes to the next pic …

Like the following .swf:

:wink:

Yeah it’s supposed to blur like this…as the pics scroll

http://www.cskern.com/newsite/sales_pics.exe

:wink: :thumb:

2880 is the magic cut off point…

(from the help file):

A filter is not applied if the resulting image exceeds 2880 pixels in width or height. If, for example, you zoom in on a large movie clip with a filter applied, the filter is turned off if the resulting image exceeds the limit of 2880 pixels.

Ah, well that explains it … that sucks … anyone have an idea as to how I can still achieve this effect?

Use the same functionality as when scrolling tilebased maps.

Here you can find some good tutorials on that:
http://oos.moxiecode.com

/Mirandir

How is that going to work because won’t it still be out of the spectrum of the filter’s working area?

You can use the MovieClip.scrollRect property. Basically that will “crop” the movie clip to get it under the 2880 size limit. It acts like a window that displays what’s inside a specified rectangle. Then, instead of actually moving the movie clip, you’ll move the x offset of the scrollRect (you’ll have to move it the opposite direction you would want the movie clip to move). sounds trickier than it is… If you keep the same set up you have, you can just use this script to get an idea of what I’m talking about:
[AS]// Motion Blur slider
//
stop();
import flash.filters.BlurFilter;
import flash.geom.Rectangle;
//
// Variables
//
var speed:Number = 1.8;
var numButtons:Number = 12;
var blFilter:BlurFilter = new BlurFilter(0, 0, 2);
var imgDist:Number = 305;
// masking scroll rectangle about the same size as the slider_mc
var mask:Rectangle = new Rectangle(0, 0, 283, 147);
slider_mc.images_mc.scrollRect = mask;
//
// Functions
//
function initButtons():Void {
for (var i = 0; i < numButtons; i++) {
var btn:MovieClip = this[“b” + i];
btn.targetx = (i * imgDist);
btn.onRelease = function() {
blurTo(slider_mc.images_mc, this.targetx);
};
}
}
function blurTo(mc:MovieClip, tx:Number):Void {
// common ease equation
mc.onEnterFrame = function() {
var dx:Number = tx - mask.x;
var blurAmount:Number = Math.abs(dx);
blFilter.blurX = blurAmount;
this.filters = [blFilter];
var movex:Number = dx / speed;
mask.x += movex;
this.scrollRect = mask;
if (Math.abs(tx - mask.x) < 1) {
delete this.onEnterFrame;
this.filters = null;
mask.x = tx;
this.scrollRect = mask;
}
};
}
//
// Begin
//
initButtons();[/AS]

Holy crap! Nice actionscripting there Devonair! Sorry that I’m not too good with AS and just a lonely designer trying to learn … but that was great, what you worked out there did exactly what I need! I think I mostly understand what you described … thanks again! :thumb:

groovy… glad that helped out… plus the original file (just noticed that was a download from my site… :slight_smile: )