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 2010-8-24

Get Adobe Flash player
by Tamanegi_kenshi 24 Aug 2010
    Embed
/**
 * Copyright Tamanegi_kenshi ( http://wonderfl.net/user/Tamanegi_kenshi )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/aLkQ
 */

package {
    import flash.display.MovieClip;

    import flash.events.*;
    import flash.display.Sprite;
    import caurina.transitions.Tweener;
    public class FlashTest extends Sprite {
        private var rectArr:Array = [];
        private var monthNum:int = 12;
        private var nowXArr:Array = [];
        private var angle:int = 0;
        private var isStage:Boolean = false;
        
        private var motoX:Number;
        private var motoY:Number;
        private var motoR:Number;
        
        public function FlashTest() {
            init();
        }//FlashTest
        
        private function init():void{
            for(var i:int = 0; i < monthNum; i++){
                for(var o:int = 0; o < 6; o++){
            var rect:Rect = new Rect(0x000000, Math.random() * 0xffffff);
            addChild(rect);
            rect.x = i * 40;
            rect.y = 515;
            rect.rotation = 90;
           // rect.rotation = Math.random() * 180 - 90;
            rectArr.push(rect);
            rect.addEventListener(MouseEvent.CLICK, rectClick);
            }
            }
            for(var j:int = 0; j < rectArr.length; j++){
           
            var radian:Number = (360 / monthNum * j + angle) * Math.PI / 180;
           
            if(j < 12){           
            Tweener.addTween(rectArr[j], { x:232 + Math.cos(radian) * 105, y:232 + Math.sin(radian) * 105, rotation:360 / monthNum * j, delay:j / 10, time:1});
            }else if(j < 24){
            Tweener.addTween(rectArr[j], { x:232 + Math.cos(radian) * 135, y:232 + Math.sin(radian) * 135, rotation:360 / monthNum * j, delay:/*(j-12)*/j / 10, time:1});
           }else if(j < 36){
            Tweener.addTween(rectArr[j], { x:232 + Math.cos(radian) * 165, y:232 + Math.sin(radian) * 165, rotation:360 / monthNum * j, delay:/*(j-12)*/j / 10, time:1});
           }else if(j < 48){
            Tweener.addTween(rectArr[j], { x:232 + Math.cos(radian) * 195, y:232 + Math.sin(radian) * 195, rotation:360 / monthNum * j, delay:/*(j-12)*/j / 10, time:1});
           }else if(j < 60){
            Tweener.addTween(rectArr[j], { x:232 + Math.cos(radian) * 225, y:232 + Math.sin(radian) * 225, rotation:360 / monthNum * j, delay:/*(j-12)*/j / 10, time:1});    
           }else if(j < 71){
            Tweener.addTween(rectArr[j], { x:232 + Math.cos(radian) * 255, y:232 + Math.sin(radian) * 255, rotation:360 / monthNum * j, delay:/*(j-12)*/j / 10, time:1});    
           }else{
            Tweener.addTween(rectArr[j], { x:232 + Math.cos(radian) * 255, y:232 + Math.sin(radian) * 255, rotation:360 / monthNum * j, delay:/*(j-12)*/j / 10, time:1, onComplete:fin});   
           }

           
           function fin():void{
               isStage = true;
           }






            }//for j
        //    stage.addEventListener(MouseEvent.CLICK, onClick);
 //       stage.addEventListener(Event.ENTER_FRAME, stageEnter);
        }//init
        
        private function stageEnter(event:Event):void{
            if(isStage == true){
            for(var i:int = 0; i < rectArr.length; i++){
            var vx:Number =(232 - mouseX) * 0.01;
            var vy:Number =(232 - mouseY) * 0.01;
            rectArr[i].x -= vx;
            rectArr[i].y -= vy;
            }
        }
    }
        
        
        private function rectClick(event:MouseEvent):void{
         //   addEventListener(Event.ENTER_FRAME, rectEnter);
          //  for(var i:int = 0; i < 31; i++){
             
           // }
           if(isStage == true){
           event.target.mouseEnabled = false;
           motoX = event.target.x;
           motoY = event.target.y;
           motoR = event.target.rotation;
           setChildIndex(event.target as Rect, rectArr.length - 1);
           Tweener.addTween(event.target, {x:232, y:232, scaleX:10, scaleY:3, rotation:0, time:1});
           Tweener.addTween(event.target, {x:motoX, y:motoY, scaleX:1, scaleY:1, rotation:motoR, delay:3, time:1, onComplete:moveFin});
           
           function moveFin():void{
               event.target.mouseEnabled = true;
           }

        }
        }
        private function rectEnter(event:Event):void{
            angle += 1;
            for(var j:int = 0; j < rectArr.length; j++){ 
            var radian:Number = (360 / monthNum * j + angle) * Math.PI / 180;
            if(j < 12){
            rectArr[j].x = 232 + Math.cos(radian) * 150;
            rectArr[j].y = 232 + Math.sin(radian) * 150;
            rectArr[j].rotation = 360 / monthNum * j + angle;
            }else if(j < 24){
            rectArr[j].x = 232 + Math.cos(radian) * 260;
            rectArr[j].y = 232 + Math.sin(radian) * 260;
            rectArr[j].rotation = 360 / monthNum * j + angle;   
            }else{
            rectArr[j].x = 232 + Math.cos(radian) * 370;
            rectArr[j].y = 232 + Math.sin(radian) * 370;
            rectArr[j].rotation = 360 / monthNum * j + angle;  
            }


           // rectArr[j].scaleX = rectArr[j].scaleY = 0.5;
            
            }
        }

        
        private function onClick(event:MouseEvent):void{
         //   addEventListener(Event.ENTER_FRAME, onEnter);
      //     for(var i:int = 0; i < monthNum; i++){
      //          var nowX:Number = rectArr[i].x;
      //          nowXArr.push(nowX);
     
       //     }
            }
        
        
        private function onEnter(event:Event):void{
            
            for(var i:int = 0; i < monthNum; i++){
        //    var vx:Number = (nowXArr[i] - 270 - rectArr[i].x) * 0.1;
        //    rectArr[i].x += vx;
              
        
            }
        }
        

    }//class
}//package
import flash.text.TextField;
import flash.display.AVM1Movie;
import flash.events.MouseEvent;
import flash.display.Sprite;
import caurina.transitions.Tweener;
class Rect extends Sprite{
    private var rect2:Rect2;
    
    function Rect(color:uint, color2:uint){
   //     for(var i:int = 0; i < 30; i++){
        buttonMode = true;
        graphics.beginFill(color2);
        graphics.drawRect(-15, -25, 5, 50);
        graphics.endFill();
        
        graphics.beginFill(color);
        graphics.drawRect(-10, -25, 20, 50);
        graphics.endFill();
        
        
        
        this.mouseChildren  = false;
        this.mouseEnabled = true;
        this.addEventListener(MouseEvent.ROLL_OVER, onOver);
        this.addEventListener(MouseEvent.ROLL_OUT, onOut);
        this.addEventListener(MouseEvent.CLICK, onClick);
     //   }
    }
    private function onOver(event:MouseEvent):void{
        rect2 = new Rect2();
     
        
        event.target.addChild(rect2);
        rect2.scaleX = 0;
        rect2.x = -5;
        rect2.y = -20;
        Tweener.addTween(rect2, {scaleX:1, scaleY:1, time:1});
        
    }
    private function onOut(event:MouseEvent):void{
        Tweener.addTween(rect2, {scaleX:0, time:1/*, onComplete:removeRect*/});
        function removeRect():void{
            event.target.removeChild(rect2);
        }

    }
    private function onClick(event:MouseEvent):void{
        
    }




}
import flash.display.Sprite;
class Rect2 extends Sprite{
    function Rect2(){
        graphics.beginFill(0xcccccc);
        graphics.drawRect(0, 0, 10, 40);
        graphics.endFill();
    }

}