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

THEATRHYTHM FINAL FANTASY

あのファイナルファンタジーが音ゲーになって3DSで登場!
クリスタルに導かれた戦士たちの
音楽を紡ぐ旅が始まる―――
http://www.square-enix.co.jp/t_ff/
Get Adobe Flash player
by undo 14 Sep 2011
package
{
    
    import flash.display.*;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.Point;
    
    [SWF(backgroundColor=0x000000,frameRate=60)]
    public class ASTest extends Sprite
    {
        
        private var _point:Point;
        private var _threshold:Number = 5;
        
        public function ASTest()
        {
            addEventListener(Event.ADDED_TO_STAGE, init);
        }
        private function init(evt:Event = null):void
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
            
            _point = new Point();
            
            var backGround:Sprite = new Sprite();
            backGround.graphics.beginFill(0x0);
            backGround.graphics.drawRect(0,0,stage.stageWidth,stage.stageHeight);
            backGround.graphics.endFill();
            addChild(backGround);
            
            stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
            stage.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
        }
        
        private function onMove(evt:MouseEvent):void
        {
            var def:Point = new Point(stage.mouseX - _point.x, stage.mouseY - _point.y);
            if(def.x>_threshold || def.x < -_threshold || def.y > _threshold || def.y < -_threshold)
            {
                var note:Note = new Note(stage.mouseX, stage.mouseY);
                addChild(note);
            }
            _point.x = stage.mouseX;
            _point.y = stage.mouseY;
        }
        
        private function onDown(evt:MouseEvent):void
        {
            var hitEffect:HitEffect = new HitEffect(stage.mouseX, stage.mouseY);
            addChild(hitEffect);
            
            for(var i:int = 0; i < 15; i++)
            {
                var hitNote:HitNote = new HitNote(stage.mouseX, stage.mouseY);
                addChild(hitNote);
            }
        }
    }
}

import caurina.transitions.Tweener;

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BlendMode;
import flash.display.GradientType;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.TimerEvent;
import flash.geom.ColorTransform;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.utils.Timer;

import flashx.textLayout.elements.OverflowPolicy;

class Note extends Sprite
{
    
    protected var _accRotation:Number = Math.random()*18-9;
    protected var _accXY:Point = new Point(Math.random()*4-2, Math.random()*4-2);
    protected var _accAlpha:Number = 0.03;
    
    public function Note(x:Number, y:Number)
    {
        super();
        this.x = x;
        this.y = y;
        
        addEventListener(Event.ADDED_TO_STAGE, init);
    }
    
    private function init(evt:Event = null):void
    {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        
        var tf:TextField = new TextField();
        var ct:ColorTransform = new ColorTransform(0,0,0,1);
        ct.redOffset = 0x88 + Math.floor(Math.random()*0x88);
        ct.greenOffset = 0x88 + Math.floor(Math.random()*0x88);
        ct.blueOffset = 0x88 + Math.floor(Math.random()*0x88);
        var format:TextFormat = new TextFormat('_sans', 24, ct.color);
        tf.defaultTextFormat = format;
        tf.autoSize = TextFieldAutoSize.LEFT;
        switch(Math.floor(Math.random()*3))
        {
            case 0:
                tf.text = '♪';
                break;
            case 1:
                tf.text = '♫';
                break;
            case 2:
                tf.text = '♩';
                break;
        }
        var bmd:BitmapData = new BitmapData(tf.width,tf.height, true, 0x00000000);
        bmd.draw(tf,null,null,null,null,false);
        var bmp:Bitmap = new Bitmap(bmd);
        bmp.x = -bmd.width/2;
        bmp.y = -bmd.height/2;
        addChild(bmp);
        
        addEventListener(Event.ENTER_FRAME, onEnter);
    }
    
    protected function onEnter(evt:Event):void
    {
        this.alpha -= _accAlpha;
        if(this.alpha<=0)
        {
            removeEventListener(Event.ENTER_FRAME, onEnter);
            this.parent.removeChild(this);
        }
        this.x += _accXY.x;
        this.y += _accXY.y;
        this.rotation += _accRotation;
    }
}

class HitNote extends Note
{
    public function HitNote(x:Number, y:Number)
    {
        super(x,y);
        
        _accXY = new Point(Math.random()*16-8, Math.random()*20-12);
    }
    
    protected override function onEnter(evt:Event):void
    {
        if(this.x > this.stage.stageWidth+10 || this.x < -10 || this.y > this.stage.stageHeight+10)
        {
            removeEventListener(Event.ENTER_FRAME, onEnter);
            this.parent.removeChild(this);
            return;
        }
        
        this.x += _accXY.x;
        this.y += _accXY.y;
        this.rotation += _accRotation;
        
        _accXY.x = _accXY.x *0.98;
        _accXY.y = Math.min(_accXY.y + 0.4, 8);
    }
}

class HitEffect extends Sprite
{
    
    private var _star0:Sprite;
    private var _star1:Sprite;
    private var _ring0:Sprite;
    private var _ring1:Sprite;
    private var _ring2:Sprite;
    
    public function HitEffect(x:Number, y:Number)
    {
        this.x = x;
        this.y = y;
        
        addEventListener(Event.ADDED_TO_STAGE, init);
    }
    private function init(evt:Event=null):void
    {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        
        _star0 = addChild(new Sprite()) as Sprite;
        _star1 = addChild(new Sprite()) as Sprite;
        _ring0 = addChild(new Sprite()) as Sprite;
        _ring1 = addChild(new Sprite()) as Sprite;
        _ring2 = addChild(new Sprite()) as Sprite;
        
        _star0.blendMode = 
            _star1.blendMode = 
            _ring0.blendMode = 
            _ring1.blendMode = 
            _ring2.blendMode = 
            BlendMode.ADD;
        
        var wo:Number = 100;
        var wi:Number = 8;
        
        _star0.graphics.beginFill(0xffffff);
        _star0.graphics.moveTo(0,-wo);
        _star0.graphics.lineTo(wi, -wi);
        _star0.graphics.lineTo(wo,0);
        _star0.graphics.lineTo(wi,wi);
        _star0.graphics.lineTo(0,wo);
        _star0.graphics.lineTo(-wi,wi);
        _star0.graphics.lineTo(-wo,0);
        _star0.graphics.lineTo(-wi,-wi);
        _star0.graphics.lineTo(0,-wo);
        _star0.graphics.endFill();
        
        _star1.graphics.beginFill(0xffffff);
        _star1.graphics.moveTo(0,-wo);
        _star1.graphics.lineTo(wi, -wi);
        _star1.graphics.lineTo(wo,0);
        _star1.graphics.lineTo(wi,wi);
        _star1.graphics.lineTo(0,wo);
        _star1.graphics.lineTo(-wi,wi);
        _star1.graphics.lineTo(-wo,0);
        _star1.graphics.lineTo(-wi,-wi);
        _star1.graphics.lineTo(0,-wo);
        _star1.graphics.endFill();
        _star1.rotation = 45;
        
        var matrix:Matrix = new Matrix();
        matrix.createGradientBox(wo*2,wo*2,0,-wo,-wo);
        
        _ring0.graphics.beginGradientFill(GradientType.RADIAL,[0xffffff, 0xffffff, 0xffffff],[0,255,0],[180,245,255],matrix);
        _ring0.graphics.drawCircle(0,0,wo);
        _ring0.graphics.endFill();
        
        _ring1.graphics.beginGradientFill(GradientType.RADIAL,[0xffffff, 0xffffff, 0xffffff],[0,255,0],[180,245,255],matrix);
        _ring1.graphics.drawCircle(0,0,wo);
        _ring1.graphics.endFill();
        
        _ring2.graphics.beginGradientFill(GradientType.RADIAL,[0xffffff, 0xffffff, 0xffffff],[0,255,0],[180,245,255],matrix);
        _ring2.graphics.drawCircle(0,0,wo);
        _ring2.graphics.endFill();
        
        //
        
        _star0.scaleX = _star0.scaleY = 
            _star1.scaleX = _star1.scaleY =
            _ring0.scaleX = _ring0.scaleY = 
            _ring1.scaleX = _ring1.scaleY = 
            _ring2.scaleX = _ring2.scaleY = 
            0;
        
        var time:Number = 1.2;
        
        Tweener.addTween(_star0, {scaleX:1, scaleY:1, alpha:0, time:time*0.8, transition:'easeOutSine'});
        Tweener.addTween(_star1, {scaleX:1.2, scaleY:1.2, alpha:0, time:time*0.8, transition:'easeOutSine'});
        Tweener.addTween(_ring0, {scaleX:1, scaleY:1, alpha:0, time:time*0.4, transition:'easeOutSine'});
        Tweener.addTween(_ring1, {scaleX:0.1, scaleY:0.1, time:time*0.2, transition:'linear'});
        Tweener.addTween(_ring1, {scaleX:0.8, scaleY:0.8, alpha:0, time:time*0.6, delay:time*0.2, transition:'easeOutCubic'});
        Tweener.addTween(_ring2, {scaleX:0.2, scaleY:0.2, alpha:0, time:time, transition:'easeOutCubic'});
        
        var timer:Timer = new Timer(time*1000,1);
        timer.addEventListener(TimerEvent.TIMER, onTimer);
        timer.start();
    }
    private function onTimer(evt:TimerEvent):void
    {
        var timer:Timer = evt.target as Timer;
        timer.removeEventListener(TimerEvent.TIMER, onTimer);
        timer.stop();
        timer.reset();
        
        this.parent.removeChild(this);
    }
}