View Full Version : Blur filter - Need to blur only the objects at the edge of the stage.
bsouth
August 6th, 2008, 11:03 AM
Hi everyone! I have created a slideshow which pulls in images with xml and then places them in a horizontal row in the middle of the stage. I have a previous and next button which moves this row of images left and right on the x axis.
I am trying to make the images blurry except for the one that is front and center on the screen. As you cycle through the images, they are blurry until they get to the center. How would I go about doing this?
I have imported the BlurFilter, but when I apply it to the imageholder mc, all of the images are blurry. How can I tell it to not blur the one currently in the center of the stage?
jwerre
August 6th, 2008, 11:46 AM
I did this very same thing not to long ago. I used an array enumerator ( you can find a really good one here: http://asapframework.org/wiki/bin/view/ASAP/Download ). once you've done that you can enumerate through the array and blur all the images that aren't the current object.
if(!getCurrentTarget){
blur Item
}else{
unblur
}
bsouth
August 6th, 2008, 01:52 PM
Thanks for the reply, jwerre. I have downloaded the asap framework and imported the classes to my fla file, but I am unsure how to go about incorporating it with my code. Do I have to rebuild my entire app using this frame work, or will it work with my current code?
After my XML data loads successfully, I am putting each image into a mc holder, which is duplicated for every image being pulled in:
var _Class:Object = getDefinitionByName("slide") as Class;
var a:MovieClip = new _Class();
a.name = "a"+i;
a.x = 886*i;
a.y = -261;
//Add the movieclip as a child in contentMC
contentMC.innerMC.addChild(a);
So, Im guessing I need to be able to cycle through the "a" movieclip and determine which one is currently in the center, so it will not blur. Thanks for your help on this, I am an AS noob.
jwerre
August 6th, 2008, 03:00 PM
1) import the enumerator : import org.asaplibrary.data.array.ArrayEnumerator;
2) create a variable: private var _myEnumerator:TraverseArrayEnumerator;
3) create a tempArray and push all your images into it:
var tempArray:Array = new Array();
for(var i:int = 0; i< numofImages; 1++){
var _Class:Object = getDefinitionByName("slide") as Class;
var a:MovieClip = new _Class();
a.name = "a"+i;
a.x = 886*i;
a.y = -261;
tempArray.push(a);
contentMC.innerMC.addChild(a);
}
4) instantiate the enumerator and pass tempArray:
_myEnumerator = new TraverseArrayEnumerator(tempArray);
now that you're enumerator is all set up you can setup a basic method that blurs
and moves all the elements in your new enumerator.
Here's the docs on how to use it: http://asaplibrary.org/api/html/
bsouth
August 6th, 2008, 03:39 PM
Ok, I have followed your steps and read up on how to use it, but I keep getting an error:
1046: Type was not found or was not a compile-time constant: TraverseArrayEnumerator.
esab
August 6th, 2008, 04:21 PM
you need to import the class you are actually using.
try: import org.asaplibrary.data.array.TraverseArrayEnumerator ;
bsouth
August 6th, 2008, 04:45 PM
you need to import the class you are actually using.
try: import org.asaplibrary.data.array.TraverseArrayEnumerator ;
Ah! Now it is working! Ok, so when I trace(myEnumerator), I get this:
org.asaplibrary.data.array::TraverseArrayEnumerato r: objects=[object slide],[object slide],[object slide],[object slide]
This is my different "slides" which are being pulled in by XML. Please excuse my ignorance, but from here, how do I set up a basic method that blurs and moves all the elements in my new enumerator.
Thanks for the help, I am learning a lot :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.