In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Webcam Test

Get Adobe Flash player
by decimealgo 13 Aug 2010

    Tags

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

package {
    import flash.text.TextField;
    import flash.system.Capabilities;
    import flash.media.Camera;
    import flash.media.Video;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            
            var name:String = null;
            if (Capabilities.os.indexOf("Mac") >- 1)
            {
                // es una mac
                name = Camera.names.indexOf("USB Video Class Video").toString();
                if(name == "-1") name = null; // Quizas es una mac con una webcam externa?
            }
            
            var tf:TextField = new TextField();
            tf.y = 250;
            tf.width = 320;
            tf.text = "Utilizando cámara: " + name;
            addChild(tf);
            
            var video:Video = new Video();
            video.attachCamera( Camera.getCamera(name) );
            addChild(video);
            
        }
    }
}