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

forked from: Rekursion

Get Adobe Flash player
by tipein123 22 Jan 2011
    Embed
/**
 * Copyright tipein123 ( http://wonderfl.net/user/tipein123 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/724n
 */

// forked from tipein123's Rekursion
// forked from tipein123's rekusiv flash on 2011-1-17
package {
    import flash.display.*;
    import flash.geom.*;
    import flash.filters.*;
    
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var Dingens:Sprite = new Sprite();
            addChild(Dingens);
            
            var glow:GlowFilter = new GlowFilter(0x0099ff,0.5,125,125)
            Dingens.filters = [glow]           
                        
            var StartPt:Point = new Point(100,350);
            var Endpt:Point = new Point(350,280);
            
            ZeichneForm(StartPt,Endpt);

            
            function ZeichneForm (pt1:Point, pt2:Point):void {
                var Laenge:Number = Point.distance(pt1,pt2);
                
                if (Laenge >= 3) { //hier steht die Mindestlänge, unter der nicht mehr gezeichnet wird.
                    var pt3:Point = new Point();
                    var Winkel:Number = Math.atan2(
                                           (pt2.x-pt1.x),
                                           (pt2.y-pt1.y)); 
                    Winkel += 0.9;
                    pt3.x = pt1.x + Math.sin(Winkel) * Laenge *.7;
                    pt3.y = pt1.y + Math.cos(Winkel) * Laenge *.7; 
                    
                    Dingens.graphics.lineStyle(1,0xff0000,0.75);
                    Dingens.graphics.moveTo(pt1.x,pt1.y);
                    Dingens.graphics.lineTo(pt2.x,pt2.y);
                    Dingens.graphics.lineStyle(1,0x0000ff,0.75);
                    Dingens.graphics.lineTo(pt3.x,pt3.y);
                    Dingens.graphics.lineStyle(1,0x00ff00,0.75);
                    Dingens.graphics.lineTo(pt1.x,pt1.y);
                    ZeichneForm(pt1,pt3); 
                    ZeichneForm(pt3,pt2); 
                }
            }  
            

            
        }
    }
}