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

ぶるぶるさん

ドラッグでぶるぶる
Get Adobe Flash player
by _wonder 01 Feb 2010
    Embed
/**
 * Copyright _wonder ( http://wonderfl.net/user/_wonder )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/2rSU
 */

package {
    /*
    *
    * ドラッグでぶるぶる
    *
    */
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    
    [SWF(backgroundColor=0)]
    public class Buruburu extends Sprite {
        private var posArray:Array = [];
        private var flag:Boolean;
        private var buruburu:int = 6;
        private var buruColor:uint = 0XFFFFFF;
        private var buruWidth:int = 6;
        
        public function Buruburu() {
            stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
            stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
            addEventListener(Event.ENTER_FRAME, enterframe);
        }
        
        private function mouseDown(e:MouseEvent):void {
            posArray = [];
            graphics.clear();
            flag = true;
        }
        
        private function mouseUp(e:MouseEvent):void {
            flag = false; 
        }
        
        private function enterframe(e:Event):void {
            if( flag ){ recPos(); }
            drawLine( posArray );
        }
        
        private function recPos():void {
            var obj:Object = new Object;
            obj.posX = mouseX;
            obj.posY = mouseY;
            posArray.push( obj );
        }
        
        private function drawLine( array:Array ):void {
            if( !array ){ return; }
            graphics.clear();
            
            var len:int = array.length;
            graphics.lineStyle(buruWidth, buruColor);
            for(var i:int = 0;i<len;i++){
                if( i == 0 ){ graphics.moveTo(array[i].posX, array[i].posY); }
                graphics.lineTo(array[i].posX+getDiff(), array[i].posY+getDiff());
            }
        }
        
        private function getDiff():Number{
            var diff:Number = Math.floor(Math.random()*buruburu - (buruburu/2) );
            return diff;
        }
    }
}