Chapter 33 Example 2

by actionscriptbible
♥0 | Line 19 | Modified 2010-02-05 16:26:29 | MIT License
play

ActionScript3 source code

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

package {
  import com.actionscriptbible.Example;
  import flash.media.Camera;
  import flash.media.Video;
  public class ch33ex2 extends Example {
    protected const S:Number = 2; //scale down factor
    public function ch33ex2() {
      var camera:Camera = Camera.getCamera();
      if (!camera) return;
      camera.setMode(stage.stageWidth/S, stage.stageHeight/S, 90, false);
      var video:Video = new Video(camera.width*S, camera.height*S);
      video.attachCamera(camera);
      video.smoothing = false;
      addChildAt(video, 0);
      trace("Used", camera.width, "x", camera.height, "@", camera.fps, "FPS");
      trace("Stage size was", stage.stageWidth, stage.stageHeight);
    }
  }
}