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

Happy new year 2011!

Get Adobe Flash player
by Pelisalinet 18 Aug 2013
    Embed
/**
 * Copyright Pelisalinet ( http://wonderfl.net/user/Pelisalinet )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/8h3v
 */

package {
    import flash.media.SoundMixer;
    import flash.net.URLRequest;
    import flash.media.SoundChannel;
    import flash.media.Sound;
    import flash.text.TextField;
    import flash.display.*;
    import flash.events.*;
    public class FlashTest extends Sprite {
        
        private var _happyTexts:Array = ["happy","new","year","on","wonderfl", (2000+11)];
        private var _texts:Array = [];
        private var _text:TextField;
        
        private var i:int;
        private var a:int;
        
        private var _sound:Sound;
        private var _soundChansel:SoundChannel;
        private var _soundMixer:SoundMixer;
        
        private var timer:int;
        private var timerPos:int;
        private var timerPos2:int;
        
        private var myText:TextField;
        
        public function FlashTest() {
            
            addEventListener(Event.ENTER_FRAME,function(e:Event):void{
            var square:Sprite = new Sprite();
            stage.addChildAt(square,0);
            square.graphics.lineStyle(3,0x00ff00);
            square.graphics.beginFill(0x0000FF);
            square.graphics.drawRect(0,0,5,10);
            square.graphics.endFill();
            square.x = stage.stageWidth-rand(0,stage.stageWidth);
            square.y = stage.stageHeight-5;
            square.addEventListener(Event.ENTER_FRAME,function(e:Event):void {
                if(timerPos >= 10){
                  e.currentTarget.y-=20;
                  e.currentTarget.x-=rand(20,-20);
                  if(timerPos2 >= 10){
                  timerPos=0; }else{ timerPos2++; }
                }else{
                  e.currentTarget.y-=10;
                  timerPos++;
                  timerPos2=0; }
            });
            });
            
            init_texts();      
            activate_texts();
            
            _sound = new Sound();
            _sound.load(new URLRequest("http://hycro.crz.jp/wonderfl/sound/u-chi-u.mp3"));
            
            _sound.play();
            
            myText = new TextField();
            myText.text = _sound.id3.artist;
            stage.addChild(myText);
            
            

            
        }
        
        private function init_texts():void{
            for(i=0; i < _happyTexts.length; i++){
                  _text = new TextField();
                  _text.text = _happyTexts[i];
                  _texts.push(_text);
              }
        }
        
        private function activate_texts():void{
            for(a=0; a < _texts.length; a++){
                stage.addChild(_texts[a]);
                _texts[a].addEventListener(Event.ENTER_FRAME,function(e:Event):void{
                    if(timer == 10){
                    e.currentTarget.y = stage.stageHeight/2-10-rand(1,200);
                    e.currentTarget.x = stage.stageWidth/2-10-rand(1,200);
                    e.currentTarget.z = rand(1,200);
                    timer=0;
                    }else{
                    timer++; }
                });
            }

        }
        
        private function rand(low:Number=0, high:Number=1):Number
        {
          return Math.floor(Math.random() * (1+high-low)) + low;
        }


        
    }
}