In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Glow

Get Adobe Flash player
by minon 08 Feb 2012
    Embed
/**
 * Copyright minon ( http://wonderfl.net/user/minon )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/qAH6
 */

package  {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.filters.GlowFilter;
    import flash.utils.getTimer;
    
    public class GlowTest extends Sprite {
        
        private var _circle:Sprite;
        private var _filter:GlowFilter;
        
        public function GlowTest() {
            
            addEventListener(Event.ADDED_TO_STAGE, _init );
            
        }
        
        private function _init(e:Event):void {
            removeEventListener(Event.ADDED_TO_STAGE, _init);
            
            _circle = new Sprite();
            _circle.graphics.beginFill( 0xCCCCCC );
            _circle.graphics.drawCircle(50, 50, 20);
            _circle.graphics.endFill();
            
            addChild( _circle );
            
            _filter = new GlowFilter(0xFF0000, 1, 5, 5, 2, 2 );
            _circle.filters = [ _filter ];
            
            addEventListener( Event.ENTER_FRAME, _enterFrame );
            
        }
        
        private function _enterFrame(e:Event):void {
            
            _filter.blurX = _filter.blurY = Math.sin( getTimer() / 100 )*30;
            _circle.filters = [ _filter ];
            
        }
        
    }

}