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

forked from: BetweenAS3 フィルターをserialで適用を検証

Get Adobe Flash player
by ProjectNya 06 Sep 2010
    Embed
/**
 * Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/5ag5
 */

// forked from kamipoo's BetweenAS3 フィルターをserialで適用を検証
package {
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.display.DisplayObject;
    
    import org.libspark.betweenas3.BetweenAS3;
    import org.libspark.betweenas3.easing.Quad;
    import org.libspark.betweenas3.tweens.ITween;

    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            graphics.beginFill( 0x0, 1 );
            graphics.drawRect( 0, 0, stage.stageWidth, stage.stageWidth );
            graphics.endFill();
            
            var shape:Shape = new Shape();
            shape.graphics.beginFill(0xFF0000, 1);
            shape.graphics.drawRect(0, 0, 100, 100);
            shape.graphics.endFill();
            shape.x = stage.stageWidth/2 - shape.width/2;
            shape.y = stage.stageWidth/2 - shape.height/2;
            addChild( shape );
            
            _blink( shape );
        }
        
        protected function _blink(target:DisplayObject):void
        {
            BetweenAS3.apply(target, {_glowFilter: {color: 0xFFFFFF, strength: 0, blurX: 0, blurY: 0}});
            var t:ITween = BetweenAS3.serial(
                BetweenAS3.tween(target, {_glowFilter: {strength: 2, blurX: 30, blurY: 30}}, null, 2, Quad.easeInOut),
                BetweenAS3.tween(target, null, {_glowFilter: {strength: 2, blurX: 30, blurY: 30}}, 2, Quad.easeInOut)
            );
            t.stopOnComplete = false;
            t.play();
        }

    }
}