A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: [RESOLVED] Blur Background effect

  1. #1
    Member
    Join Date
    Apr 2008
    Posts
    97

    resolved [RESOLVED] Blur Background effect

    Yahoo has a set of components that are ... nice.
    Examples Here

    One thing I really like about the Alert component is that it blurs everything that is behind the alert. I want to use this effect but not with an alert, and I'm not sure the best way of approaching this, any ideas?

  2. #2
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    I think the Alertbox component automaticaly blurs out the background and everything on it, so it's not possible to see how that exact code works.

    You could take a look here, at the Adobe Livedocs (you can find them via google).

    Scroll down to see an example (after all the explanation), it's class based, but I'm sure you can get it to work on a normal timeline

    Hope this helps you!
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  3. #3
    Member
    Join Date
    Apr 2008
    Posts
    97
    yeah i can use the blur filter dynamicly , programmaticly and all that jazz. But I am specifically looking for how they blur EVERYTHING below the alert box.... I dont think (or aleast hope) that they dont have to apply a blur effect to every item on the stage and then remove it.
    Last edited by FlashDevSD; 06-10-2008 at 07:04 PM.

  4. #4
    lemon juice hurts your eyes florianvanthuyn's Avatar
    Join Date
    Jul 2005
    Location
    Merelbeke, Belgium
    Posts
    546
    No, but what you can do is dynamicaly make a MC:

    Code:
    var myBlurMC:MovieClip = new MovieClip();
    myBlurMC.width = stage.stageWidth;
    myBlurMC.height = stage.stageHeight;
    
    addChild(myBlurMC);
    And then add the blurfilter to that MC.
    You can set it's visible property to false or true, when you need it or not [I hope ].

    Cheers
    Florian Vanthuyne

    WAR AGAINST SOLVED THREADS
    mark yours as Resolved under Thread Tools!

  5. #5
    Member
    Join Date
    Apr 2008
    Posts
    97
    I got that, but i need to be able to in theory:
    1) take screen grab of the flash stage, with all objects on it
    2) add the screen grab in a movie clip
    3) apply blur filter
    4) addChild to the stage

    I just not sure how to do step 1 and 2

  6. #6
    Member
    Join Date
    Apr 2008
    Posts
    97
    so I got the blur filter to apply to everything the stage, by
    var myHome:* = stage.getChildAt(0);
    myHome.filters = [blurFilter];

    How would you recommend applying the blur filter to all children below a specific mc?

  7. #7
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Blurring everything is as easy as targetting the stage:

    PHP Code:
    filters = [new BlurFilter(881)]; 
    but obviously that's going to fuzz your 'alert' or whatever on the top as well...the good news is that filters are inherited down the display tree so you only need to hit the children of the stage and skip the first one:

    PHP Code:
    var BLUR:Array = [new BlurFilter(16161)];

    var 
    i:int this.numChildren 1;
    while(
    0){
        
    i--;
        
        
    this.getChildAt(i).filters BLUR;

    That will fuzz everything except the topmost z-index...you can use that and just replace 'this' with the level you want to work at and it will cascade automatically. One caveat: you're overwriting the filters property so any other effects will be destroyed when you run this.

  8. #8
    Developer
    Join Date
    Apr 2007
    Location
    UK
    Posts
    324
    My CS3 Alert does a similar thing in that it takes a snapshot of the stage and applies a blur filter to that. Tha drawback with that is that if there is moving images you won't see it.

    I had no idea someone else had already done a customizable Alert class. I'll have to accelerate production of the second version of my class!
    now known as dVyper

  9. #9
    Member
    Join Date
    Apr 2008
    Posts
    97
    So...how did you take a snapshop of the stage? I don't need an alert, I want to use it on a menu, like when its open blur everything behind it.

    Nice work by the way!!!

  10. #10
    Member
    Join Date
    Apr 2008
    Posts
    97
    Hey just dug through the code... got it what i wanted, thanks, YOU ROCK MAN!!!

    What parameter would you adjust to make the color less intense?
    Last edited by FlashDevSD; 06-19-2008 at 12:29 PM.

  11. #11
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Do a search for desaturating via the colorMatrixFilter...or you could just throw up a flood-fill with a low alpha...

  12. #12
    Member
    Join Date
    Apr 2008
    Posts
    97
    just change the multiplier value to 256 in the .merge.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center