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

flash on 2010-5-28

Get Adobe Flash player
by yd_niku 28 May 2010
/**
 * Copyright yd_niku ( http://wonderfl.net/user/yd_niku )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ZWbz
 */

package {
    import flash.display.Sprite;
    import frocessing.display.*;
    import flash.geom.*;
    public class FlashTest extends F5MovieClip2DBmp{
        public function FlashTest() {
            super();
        }
        private var _points:Vector.<Sprite> = new Vector.<Sprite>();
       
        public function setup():void{
            size( stage.stageWidth, stage.stageHeight);
            background(0);
            noFill();
            stroke( 255, 0.1 );
            
            var p:Sprite = new Ball(-100,232);
            addChild(p);
            p = new Ball(10,232);
            addChild(p);
            _points.push(p);
            p = new Ball(160,100);
            addChild(p);
            _points.push(p);
            p = new Ball(320,100);
            addChild(p);
            _points.push(p);
            p = new Ball(446,232);
            addChild(p);
            _points.push(p);
        }
        
        private var _t:Number = 0;
        public function draw():void{
            background(0);
            beginShape();
            moveTo(_points[0].x,_points[0].y+Math.sin(_t)*20);
            bezierTo(
                _points[1].x, _points[1].y+Math.cos(_t)*20,
                _points[2].x, _points[2].y+Math.sin(_t)*20,
                _points[3].x, _points[3].y+Math.cos(_t)*20
            );
            
            moveTo(_points[0].x,_points[0].y+Math.sin(_t)*10);
            bezierTo(
                _points[1].x, _points[1].y+Math.cos(_t)*10,
                _points[2].x, _points[2].y+Math.sin(_t)*10,
                _points[3].x, _points[3].y+Math.cos(_t)*10
            );
            
            endShape();
            
            _t += 0.05;
        }
    }
}


import flash.display.*;
import flash.events.*;
class Ball extends Sprite{
    public function Ball(sx:Number,sy:Number,color:uint=0xFFFFFF){
        graphics.beginFill(color);
        graphics.drawCircle(0,0,4);
        graphics.endFill();
        
        x = sx;
        y = sy;
        addEventListener(MouseEvent.MOUSE_DOWN,mouseDown);
    }
    private function mouseDown(e:Event):void{
        startDrag();
        addEventListener(MouseEvent.MOUSE_UP,mouseUp);
        stage.addEventListener(MouseEvent.MOUSE_UP,mouseUp);
    }
    private function mouseUp(e:Event):void{
        stopDrag();
        
        removeEventListener(MouseEvent.MOUSE_UP,mouseUp);
        stage.removeEventListener(MouseEvent.MOUSE_UP,mouseUp);
    } 
    
}