flash on 2013-5-30

by hemingway
♥0 | Line 51 | Modified 2013-05-31 14:02:25 | MIT License
play

ActionScript3 source code

/**
 * Copyright hemingway ( http://wonderfl.net/user/hemingway )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/ArA4
 */

package
{
    import flash.display.*;
    import flash.events.*;
    
    public class Main extends Sprite
    {
        public function Main()
        {
            addChild(new PV());
        }
    }
}

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

class PV extends Sprite
{
    private var _z :Number = 2;
    
    public function PV()
    {
        init();
        
        addEventListener(Event.ADDED_TO_STAGE, addedToStage);
    }
    
    private function addedToStage($e:*) :void
    {
        removeEventListener(Event.ADDED_TO_STAGE, addedToStage);
        
        init();
        
        stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
    }

    private function init() :void
    {
        for (var $x:int = 0; $x<465; $x+=15)
        {
            for (var $y:int = 0; $y<465; $y+=15)
            {
                graphics.beginFill(0xDCDCDC);
                graphics.drawRect(1*$x, 1*$y, _z, _z);
                graphics.endFill();
            }
        }
    }
    
    private function onMouseMove($e:MouseEvent) :void
    {
        if (_z < 15)
        {
            _z += 0.25;
        }else{
            _z -= 0.25;
        }
        
        init();
    }
}