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 2012-11-12

Get Adobe Flash player
by mutantleg 12 Nov 2012
    Embed
/**
 * Copyright mutantleg ( http://wonderfl.net/user/mutantleg )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/4ehq
 */

package {
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        
    public var sx:Number = 0;
    public var sy:Number = 0;        
        
    public var cx:Number = 200;
    public var cy:Number = 200;
        
        public var p:Sprite;
        
   public var bx:Number = 0;
   public var by:Number = 0;     
        
        public var b:Sprite;
        
        public function FlashTest() {
            
            p = new Sprite();
             p.graphics.clear();
             p.graphics.lineStyle(2,0);
             p.graphics.beginFill(0xFF0000, 1);
             p.graphics.drawCircle(0,0, 8);
             p.graphics.endFill();
            addChild(p);
            
            b = new Sprite();
             b.graphics.clear();
             b.graphics.lineStyle(2,0);
             b.graphics.drawRect(0,0, 400,400);
            addChild(b);
            
            
            stage.addEventListener(Event.ENTER_FRAME, onEnter);
            stage.addEventListener(MouseEvent.MOUSE_DOWN, mdown);
            stage.addEventListener(MouseEvent.MOUSE_UP, mup);
        }//ctor
        
        public var u:Number = 0;
        public var md:int = 0;
        
        public function mdown(e:MouseEvent):void
        {
            md = 1;
        }//mdown
        
        public function mup(e:MouseEvent):void
        {
            md = 0;
        }//mup
        
        
        public function onEnter(e:Event):void
        {
            graphics.clear();
            graphics.lineStyle(2,0);
            
            
            sx = (mouseX + (cx-200));
            sy = (mouseY + (cy-200));
            
            var camx:Number = 0;
            var camy:Number = 0;
            camx = sx - 200;
            camy = sy - 200;
            
            p.x = cx - camx;
            p.y = cy - camy;
            
            b.x = bx - camx;
            b.y = by - camy;
            
            var ax:Number;
            var ay:Number;
            
            ax = mouseX + sx-200;
            ay = mouseY + sy-200; 
            
            graphics.drawCircle(sx-camx-200,sy-camy-200, 30);
            graphics.drawCircle(ax-camx,ay-camy,30);
            
            var t:Number;
            
            var kx:Number;
            var ky:Number;
            
            u += 0.01;
            if (u >= 0.1) { u = 0; }
            
            for (t = 0; t < 1; t+= 0.1)
            {
                kx = cx + (ax-cx)*(t+u);
                ky = cy + (ay-cy)*(t+u);
                graphics.drawCircle(kx-camx,ky-camy,4);
                
            }//nextt
            
            if (md)
            {
             cx += (ax-cx)*0.1;
             cy += (ay-cy)*0.1;   
             }
            
        }//onenter
        
    }//classend
}