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 2013-5-15

Get Adobe Flash player
by mutantleg 15 May 2013
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/bpfa
 */

package {
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
       
        public function FlashTest() {
            // write as3 code here..
       
           stage.addEventListener(Event.ENTER_FRAME, onEnter);     
        }//ctor
        
        public function onEnter(e:Event):void
        {
            graphics.clear();
            
            graphics.lineStyle(2,0);
            
            var mx:Number;
            var my:Number;
            
            mx = mouseX;
            my = mouseY;
            
            graphics.drawCircle(mx, my, 8);
            
            var ox:Number;
            var oy:Number;
            
            ox = 350;
            oy = 200;
            
            graphics.drawCircle(ox, oy, 8);
            
            graphics.moveTo(mx, my);
            graphics.lineTo(ox, oy);
            
            var kx:Number;
            var ky:Number;
            
            kx = mx + (ox - mx) * 0.5;
            ky = my + (oy - my) * 0.5;
            
            graphics.drawCircle(kx, ky, 8);
            
            var dx:Number;
            var dy:Number;
            var jx:Number;
            var jy:Number;
            
            dx = ox - mx;
            dy = oy - my;
            
            
            var mag:Number;
            mag = Math.sqrt(dx*dx+dy*dy);
            dx /= mag;
            dy /= mag;
            
            var d:Number;
            d = mag;
            if (d > 300) { d = 300;}
            
            jx =  (-dy *0.5)*(300-d);
            jy =  (dx*0.5) *(300-d);
            
            graphics.drawCircle(kx+jx, ky+jy, 8);
            
                graphics.moveTo(kx,ky);
            graphics.lineTo(kx+jx,ky+jy);
            
            
            graphics.lineStyle(4, 0xff);
            
        
            graphics.moveTo(ox,oy);
             graphics.lineTo(kx+jx,ky+jy);

            graphics.moveTo(kx+jx, ky+jy);
            graphics.lineTo(mx,my);            
            
        }//onenter
        
        
    }//classend
}