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

Der springende Punkt

Get Adobe Flash player
by tipein123 05 Mar 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/erbN
 */

package {
    import flash.geom.Point;
    import flash.display.*;
    import flash.events.*;
    import flash.utils.*;
    import flash.filters.*;
    import flash.text.*;
    
        [SWF(width="800",height="800",backgroundColor="0xaaaaaa",frameRate="100")]

    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            
            var Test:Teilchen;
            Test = new Teilchen("weiss",400,400);
            addChild (Test);
 

       }
       
       


    }
}




  import flash.display.Sprite;
  import flash.events.*;

 class Teilchen extends Sprite {
     
       public var Farbliste:Array = new Array(
             "rot", 0xff0000, "grün", 0x000ff00, "blau", 0x0000ff , "weiss", 0xffffff
             ,"grau", 0x888888, "hellgrau", 0xbbbbbb , "dunkelgrau", 0x444444
             , "lila", 0x800080 , "rosa", 0xFF00FF, "gelb", 0xFFFF00 , "türkis", 0x00FFFF 
             , "Aliceblau",  0xF0F8FF, "Antik-Weiß", 0xFAEBD7, "Aquamarinblau", 0x7FFFD4, "Blauviolett", 0x8A2BE2, "Braun", 0xA52A2A, "grobes Braun", 0xDEB887     
             , "Kadettblau", 0x5F9EA0, "Hellgrün", 0x7FFF00, "Schokolade", 0xD2691E, "Kornblumenblau", 0x6495ED, "Koralle", 0xFF9966, "Mais", 0xFFF8DC     
             , "dunkle Goldrutenfarbe", 0xB8860B, "Dunkelgrün", 0x006400, "dunkles Khaki", 0xBDB76B, "dunkles Magentarot", 0x8B008B     
             , "dunkles Olivgrün", 0x556B2F, "dunkles Orange", 0xFF8C00, "Dunkelrot", 0x8B0000, "dunkle Lachsfarbe", 0xE9967A     
             , "Khaki", 0xF0E68C, "helle Lachsfarbe", 0xFFA07A, "Orange", 0xFFA500, "Olivgrün", 0x808000, "Mitternachtsblau", 0x191970     
            ,"schwarz", 0x000000);
        //, "", 0x000000 , "", 0x000000, "", 0x000000 , "", 0x000000 , "", 0x000000, "", 0x000000  
        
       public var ZielpunktX:uint = Math.floor(Math.random() * 800);
       public var ZielpunktY:uint = Math.floor(Math.random() * 800);

     
       public function Teilchen (Farbe:String,PosX:uint,PosY:uint):void {
           graphics.lineStyle( 1,getNegativFarbe (Farbe));  
           graphics.beginFill(getFarbe (Farbe),1);
           graphics.drawCircle(0,0, 10);
           graphics.endFill(); 
           this.x = PosX;
           this.y = PosY;
           this.addEventListener(Event.ENTER_FRAME, aktionen);
       }

       public function getNegativFarbe(Farbe:String):uint
         {
             return 0xffffff - getFarbe (Farbe);
         }

       
       public function getFarbe(Farbe:String):uint
         {    
            
            var Position:uint = Farbliste.indexOf (Farbe) + 1;
            if (Farbliste.indexOf (Farbe) < 0) {Position = 1} //Farbe nicht in Liste -> Mach es in Rot !
             
             return Farbliste[Position] // 0xff0000; // 254;
       }
       
       
       public function aktionen (e:Event):void //
        {
            if (this.x < ZielpunktX) {this.x += 1} else {this.x -= 1}
            if (this.y < ZielpunktY) {this.y += 1} else {this.y -= 1}
            if (this.x == ZielpunktX && this.y == ZielpunktY)
               {ZielpunktX = Math.floor(Math.random() * 800); 
                ZielpunktY = Math.floor(Math.random() * 800);
                }
            this.x += Math.floor(Math.random() * 3 - 1);
            this.y += Math.floor(Math.random() * 3 - 1);
        }


 }