flash on 2010-10-5

by plus-tic
♥0 | Line 36 | Modified 2010-10-05 22:56:22 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.AVM1Movie;
    import flash.geom.Point;
    import flash.events.MouseEvent;
    import flash.display.Shape;
    import flash.display.Sprite;
    import com.bit101.components.HUISlider;
    public class Main extends Sprite {
        public var s:Shape;
        public function Main() {
            root.transform.perspectiveProjection.fieldOfView = 1;
            for(var i:uint = 0; i<200; i++){
                s = new Shape();
                s.graphics.beginFill(Math.random() * 0xFFFFFF);
                s.graphics.drawRect( -5, -5, 5, 40);
                s.x = Math.random() * stage.stageWidth;
                s.y = stage.stageHeight / 2;
                s.z = Math.random() * 8800;
                addChild(s);
            }
            var slider:HUISlider = new HUISlider(this,132,400,"z",function():void{s.z = slider.value;});
            slider.minimum = -100;
            slider.maximum = 500;
            stage.addEventListener(MouseEvent.CLICK, changePP)            
        }
        public function changePP(e:MouseEvent):void{
                setRoot(e.stageX, e.stageY);
                showInfo();
        }
        
        public function setRoot(x:Number, y:Number):void{
            root.transform.perspectiveProjection.projectionCenter = new Point(x,y);
        }
        //fv.addEventListener(Event.CHANGE, setFieldOfView);
        
        public function showInfo():void{
            
        }

    }
}