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

Halloween 2010

ハロウィンネタで作った。後悔はしていない
Get Adobe Flash player
by okoi 04 Oct 2010
/**
 * Copyright okoi ( http://wonderfl.net/user/okoi )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/63No
 */

//
//    Halloween 2010
//
//
package 
{
    import flash.display.Sprite;
    import flash.events.Event;
    
    [SWF(width = "465", height = "465")]
    
    /**
     * ...
     * @author 
     */
    public class Main extends Sprite 
    {
        private var pumpkin:Pumpkin;
        private var step:int;
        
        public function Main():void 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point
            graphics.beginFill(0);
            graphics.drawRect(0, 0, stage.stageWidth, stage.stageHeight);
            graphics.endFill();
            
            
            pumpkin = new Pumpkin();
            pumpkin.x = stage.stageWidth / 2;
            pumpkin.y = stage.stageHeight / 2;
            addChild( pumpkin );
            
            step = 0;
            
            addEventListener(Event.ENTER_FRAME, Update);
        }
        
        private function Update(e:Event) : void
        {
            
            pumpkin.y = stage.stageHeight / 2 + Math.sin( step*2 % 360 * Math.PI / 180 ) * 20;
            
            step++;
        }
        
    }
    
}
import flash.display.GradientType;
import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.display.BlendMode;
import flash.filters.BlurFilter;


class Pumpkin extends Sprite
{
    private var body:Sprite;
    private var face:Sprite;
    private var candle:Sprite;
    private var step:int;
    
    public function Pumpkin() {
    
        var g:Graphics;
        var color:uint = 0xFFBD38;
                
        //    Body
        body = new Sprite();
        drawBody( body.graphics );
        drawFace( body.graphics );
        //    face
        face = new Sprite();
        drawFace( face.graphics, false );
        
        //-------------
        //    Candle
        candle = new Sprite();
        var m:Shape = new Shape();
        drawBody( m.graphics );
        candle.mask = m;
        candle.addChild( m );
        
        
        addChild( candle );
        
        body.blendMode = BlendMode.LAYER;
        addChild( body );
        face.blendMode = BlendMode.ERASE;
        body.addChild( face );
        
        
        step = 0;
        addEventListener(Event.ENTER_FRAME, Update);
    }
    
    private function drawBody(g:Graphics):void
    {    
        var color:uint = 0xFFBD38;
        
        g.lineStyle( 10, 0xD68D00 );
        
        g.beginFill(color);
        g.drawEllipse( -150, -70, 100, 200);    //    最後列
        g.endFill();
        
        g.beginFill(color);
        g.drawEllipse(   50, -70, 100, 200);
        g.endFill();
        
        g.beginFill(color);
        g.drawEllipse( -100, -60, 100, 200);
        g.endFill();
        
        g.beginFill(color);
        g.drawEllipse(    0, -60, 100, 200);
        g.endFill();
        
        g.beginFill(color);
        g.drawEllipse(  -50, -50, 100, 200);        //    中央
        g.endFill();
        
    }
    
    private function drawFace(g:Graphics, line:Boolean = true ):void
    {
        //    eye
        if( line )    g.lineStyle(5, 0xD68D00);
        g.beginFill(0);
        g.moveTo( -70, 0 );
        g.lineTo( -30, 40 );
        g.lineTo( -110, 40 );
        g.endFill();

        if( line )    g.lineStyle(5, 0xD68D00);
        g.beginFill(0);
        g.moveTo( 70, 0 );
        g.lineTo( 30, 40 );
        g.lineTo( 110, 40 );
        g.endFill();    
        
        //    mouth
        if( line )    g.lineStyle(5, 0xD68D00);
        g.beginFill(0);
        g.moveTo( -110, 50 );
        g.curveTo( 0, 100, 110, 50 );
        g.curveTo( 0, 200, -110, 50 );
        g.endFill();    
    }
    
    
    private function Update(e:Event):void
    {
        var g:Graphics = candle.graphics;
        var size:Number = 70;
        
        candle.filters = [new BlurFilter(15,15,Math.random()*10+5)];
        
        g.clear();
        g.beginFill(0xFFEB44);
        g.drawCircle(0, 50, size);
        g.endFill();
        
        step++;
    }
    
}