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

splash

Get Adobe Flash player
by Scmiz 08 Apr 2011
    Embed
/**
 * Copyright Scmiz ( http://wonderfl.net/user/Scmiz )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/jntf
 */

package {
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var dot:Dot = new Dot(3, 0, 0);
            this.addChild(dot);
            dot.x = 465 / 2;
            dot.y = 465 / 2;
        }
    }
}
import flash.events.Event;
import flash.display.Sprite;

class Dot extends Sprite {
    private const RADIUS:Number = 2.0;
    private const TIMER_MAX:uint = 25;
    
    private var _count:uint;
    private var _timer:uint;
    private var _speedX:Number;
    private var _speedY:Number;

    public function Dot(count:uint, speedX:Number, speedY:Number) {
        _count = count;
        _timer = TIMER_MAX;
        _speedX = speedX;
        _speedY = speedY;
        
        this.graphics.beginFill(0xFF0000FF);
        this.graphics.drawCircle(-RADIUS / 2, -RADIUS / 2, RADIUS);
        this.graphics.endFill();
        
        this.addEventListener(Event.ENTER_FRAME, proc);
    }
    
    private function proc(e:Event):void {
        this.x += _speedX;
        this.y += _speedY;
        this.alpha = 1.0 - ((50 - _timer) / 50);

        if (_timer > 0) {
            --_timer;
        }
        else {            
            if (_count > 0) {
                for (var index:uint = 0; index < 8; ++index) {
                    var deg:Number = 45.0 * index;
                    var cos:Number = Math.cos(Util.DegToRad(deg));
                    var sin:Number = Math.sin(Util.DegToRad(deg));
                    var dot:Dot = new Dot(_count - 1, cos * 2, sin * 2);
                    dot.x = this.x;
                    dot.y = this.y;
                    this.parent.addChild(dot);
                }
            }

            this.removeEventListener(Event.ENTER_FRAME, proc);
            this.parent.removeChild(this);
        }
    }
}

class Util {
    static public function DegToRad(deg:Number):Number {
        return deg * Math.PI / 180.0;
    }
}