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: flash on 2010-4-28

Get Adobe Flash player
by aktm 28 Apr 2010
/**
 * Copyright aktm ( http://wonderfl.net/user/aktm )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/jlpJ
 */

// forked from aktm's flash on 2010-4-28
package {
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.text.TextField;
    
    public class Main extends Sprite {
    	
    	    private var _sikaku:Sprite;
    	    private var _maru:Sprite;
    	    private var _btn:Sprite
    	    
        public function Main() {
        	    //放射状の線を描画
            this.graphics.lineStyle(2,0x00ffff);
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(200,50); 
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(150,100);
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(100,150); 
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(50,200);
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(100,250); 
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(150,300); 
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(200,350);
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(250,300);
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(300,250); 
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(350,200); 
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(300,150); 
            this.graphics.moveTo(200,200);
            this.graphics.lineTo(250,100);  
            
            //ボタン、クリックできる範囲がとても狭いのはなぜ?
            _btn = new Sprite();
            _btn.graphics.beginFill(0x00ffff);
            _btn.graphics.drawCircle(200,200,20);
            _btn.graphics.endFill();
            _btn.buttonMode = true;
            _btn.addEventListener(MouseEvent.CLICK,onClick);            
            this.addChild(_btn);                       
            
            this.addEventListener(Event.EXIT_FRAME,onEnter);
                       
            var tf:TextField = new TextField();
            tf.text = "CLICK";
            tf.textColor = 0x000000;
            tf.selectable = false;
            tf.x = 180;
            tf.y = 190;
            addChild(tf);
            
            //回る丸
            _maru = new Sprite();
            _maru.graphics.beginFill(0x800000,0.75);
            _maru.graphics.drawCircle(150,10,10);
            _maru.graphics.endFill();
            _maru.x = 200;
            _maru.y = 200;
            this.addChild(_maru);
                                                                                  
        }
        //クリックで四角を描画。クリックするごとに少しずつ回転したものを重ねて描画したいのに動きません。
        private function onClick(e:MouseEvent):void{
        	   var _sikaku:Sprite = new Sprite;
        	   _sikaku.graphics.beginFill(0x0000ff,0.2);
        	   _sikaku.graphics.drawRect(125,300,150,150);
        	   _sikaku.x += 5;
        	   _sikaku.y += 5;
        	   this.addChild(_sikaku);
              	           	          	   
        }
        
        private function onEnter(event:Event):void{
        	    _maru.rotation ++;
        }
    }
}