PDA

View Full Version : Hot to apply blur to specific Panel on click?


blu3
09-25-2007, 02:46 PM
Hi,

How can i apply blur effect to a Panel component when i click on a Button component inside that same panel?

thanks in advance

TruePatriot
09-25-2007, 10:26 PM
Here you go:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init();">
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.containers.Panel;
import mx.controls.Button;
import mx.effects.Blur;

private var panel:Panel = new Panel();
private var button:Button = new Button();
private var blur:Blur = new Blur();

public function init():void {
addChild(panel);
panel.addChild(button);
button.label="Blur Panel";
button.addEventListener(FlexEvent.BUTTON_DOWN,blur Me);
blur.duration=99999;
blur.repeatCount=0;
}

public function blurMe(event:FlexEvent):void {
if (blur.isPlaying){
blur.end();
blur.target=null;
} else {
blur.target=event.currentTarget.parent;
blur.play();
}
}
]]>
</mx:Script>
</mx:Application>

blu3
09-26-2007, 07:42 AM
Thanks a lot TruePatriot, i really appreciate it :)

best regards