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

マスクトランジション(なぞのモニョモニョしたのが出る)

Get Adobe Flash player
by otherone 15 Sep 2010
    Embed
/**
 * Copyright otherone ( http://wonderfl.net/user/otherone )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/AmFS
 */

/*

*/
package
{
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.text.TextField;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    import caurina.transitions.Tweener;
    
    public class Main extends Sprite 
    {
        private var msk:Sprite=new Sprite;
        private var trgtH:Number;
        private var trgtW:Number;
        private var cnt:int=0;
        private var txt_fld:TextField;
        
        public function Main():void 
        {
            txt_fld = new TextField();
            txt_fld.text="count:"
            addChild(txt_fld);
            
            var trgt:Shape = new Shape();
            stage.addChild(trgt);
            var g:Graphics = trgt.graphics;
            g.beginFill(0x666666, 1.0);// 単一色のスタイル設定
            g.drawRect(50, 100, 300, 300);// 矩形を描画
            
            stage.addChild(msk);
            
            trgtW = trgt.width;
            trgtH = trgt.height;
            
            
            //タイマーイベント(1000分の1秒、回数を設定)
            var timer:Timer = new Timer(1);
            timer.addEventListener(TimerEvent.TIMER, fn_time);
            timer.start();
            function fn_time(event:TimerEvent):void 
            {
            _dot();
            }
            
            
            
            //エンターフレーム処理
            addEventListener(Event.ENTER_FRAME, enterFrameHandler);
            function enterFrameHandler(event:Event):void
            {    
            trgt.mask = msk;
            }
            
        }
        
        
        public function _dot():void
        {
            cnt++
            
            if(cnt<=2000){
                        txt_fld.text="count:"+cnt    
                
            
        var shape:Shape = new Shape();
        msk.addChild(shape);
        var g:Graphics = shape.graphics;
        //g.lineStyle (1, 0x000000, 1.0);    // 線のスタイル指定
        g.beginFill (0x000000, 1.0);    // 面のスタイル設定
        g.drawCircle  (0,0, ran(100));
        
        shape.x = ran(trgtW);
        shape.y = ran(trgtH);
        shape.scaleX=shape.scaleY=0
        
        Tweener.addTween(shape,{scaleX:2,scaleY:2,time:2})        
            }
        }
        
        
        public function ran(range:Number):Number 
        {
        var v:uint = Math.floor(Math.random() * range);    
        return v;
        }
        
    }
}