flash on 2011-5-27

by tepe
♥0 | Line 29 | Modified 2011-05-27 12:15:30 | MIT License
play

ActionScript3 source code

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

package {
    import flash.display.Sprite;
    import flash.media.*;
    import flash.events.*;
    public class FlashTest extends Sprite {
        private var camera:Camera;
        private var video:Video;
        public function FlashTest() {
            stage.addEventListener(MouseEvent.CLICK,onClick);
            
        }
        private function onClick(e:MouseEvent):void{
            startCamera();
        }

        
        //----------------------------------------------------------------------------    
        private const WIDTH:int = 232;
        private const HEIGHT:int = 232;
    
        private function startCamera():void{
            
            camera = Camera.getCamera();
            if ( camera == null ) {
            } else {
                start();

            }
            
        }
        

        
        private function start():void {
            
            //camera.setMode(WIDTH,HEIGHT, 60);//カメラ設定 width, height, frame
            video = new Video(WIDTH,HEIGHT);//ビデオサイズ width, height
            video.attachCamera(camera);
            //video.scaleX = video.scaleY = 0.3;
            //video.x = 100; video.y = 200;
            this.addChild( video );
        }
    }
}