flash on 2012-12-4

by AAMO0
♥0 | Line 24 | Modified 2012-12-04 15:17:20 | MIT License
play

ActionScript3 source code

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

package {
    import flash.geom.Matrix;
    import flash.events.Event;
    import flash.display.GradientType;
    import flash.display.Sprite;
 
    public class FlashTest extends Sprite {
       
       private var cont:Sprite = new Sprite();
      
       
        public function FlashTest() {
            // write as3 code here..
            
            var matrix:Matrix = new Matrix();
            matrix.createGradientBox(150,2000,90/180*Math.PI);
            cont.graphics.beginGradientFill(GradientType.LINEAR,[0xff0000,0x0000ff],[1,1],[0,255],matrix);
            cont.graphics.drawRect(0,0,150,2000);
            cont.graphics.endFill();
            
            cont.y = stage.stageHeight/2 - cont.height/2;
            
            addChild(cont);
            
            addEventListener(Event.ENTER_FRAME, onEnter);
        }
        private function onEnter(e:Event):void{
            
            var perc:Number = mouseY/stage.stageHeight;
            var maxHeight:int = stage.stageHeight - cont.height;
            
            cont.y = maxHeight*perc;
            
        }

    }
}