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

マウスについてくる火

Get Adobe Flash player
by nyamogera 18 Jan 2009
// write as3 code here..
package 
{
    import flash.display.*;
    import flash.events.Event;
    import flash.geom.*;

    [SWF(width="320", height="320", backgroundColor="0x000000", frameRate="20")]

    public class Fire extends Sprite
    {
        public function Fire() : void
        {
            addEventListener( Event.ENTER_FRAME, EnterFrame) ;
            
        }
        
        private function EnterFrame( event:Event ) : void
        {
 
            var p:Point = new Point();
            p.x = mouseX + Math.random() * 10 - 5;
            p.y = mouseY + Math.random() * 10 - 5;
            addChild( new Sphere(p) );

        }

    }    

}

import flash.events.Event;
import flash.display.*;
import flash.geom.*;
import flash.filters.BlurFilter;

class Sphere extends Sprite
{
    public function Sphere(point:Point) : void
    {

        blendMode = BlendMode.ADD;
         x = point.x;
         y = point.y;   
        var shape:Shape = new Shape();
        var r:Number = 30//Math.random() * 30 + 15;

        shape.graphics.beginFill(0xff0f00);
        shape.graphics.drawCircle(0, 0, r);

        addChild( shape );

        var blur : BlurFilter = new BlurFilter(16,16);
        filters = [blur];

        addEventListener( Event.ENTER_FRAME, EnterFrame);
    }    

    public function EnterFrame(event:Event) : void
    {
        scaleY *= 0.95;
        scaleX *= 0.95;
        //alpha = scaleY;
        this.y -= 3;

        if( scaleX <= 0.1 )
        {
            removeEventListener( Event.ENTER_FRAME, EnterFrame);

            //    さようなら
            if( parent )
            {
                parent.removeChild( this );
            }
        }
    }

}