MXML/AS error in Camera.get()

i am new to flex/AS programming In the below code what is this error and how to resolve it

     <?xml version="1.0" encoding="utf-8"?>
     <mx:Application xmlns:mx="" layout="absolute">

             import mx.controls.Button;
             import mx.controls.Alert;

             public function clickhandler(event:Event):void

                var as Button;
                if (button.label=='Test camera')
             "Starting camera1");
                       //myCam = Camera.get();
                       if (Camera.names.length > 0) {
                          cam = Camera.getCamera();
                          if (cam != null) {
                                cam.setMode(160,120,8,false); // error here
                      "Cannot connect camera");


            <mx:Button id="button1" label="Test camera" width="100" click="clickhandler(event)" />


     /home/tom/programs/flex/camera.mxml(19):  Error: Access of undefined property myCam.

        cam = Camera.getCamera();


Your code is confusing... you show an error related to myCam, but myCam is commented out!

Let's assume that the error has to do with the cam variable. Have you defined cam?

     private var cam:Camera;

     var cam:Camera = Camera.getCamera();

Check the example at the bottom of the page for attachCamera()

Following your code...

     private var participantVideo:Video = new Video( 160 , 120 );

     //later in your function
     participantVideo.attachCamera( cam );

Need Your Help

How to implement multi-touch in an android game that uses a main game panel surface view and a main thread

android 2d game-engine multi-touch

I started learning android programming a couple of weeks ago. I am a beginner so I followed this tutorial on making a simple 2D game engine:

How to restart java web start application programatically

java deployment jnlp java-web-start auto-update

I am trying to achieve the automatic update for my java web-start applicaiton. Logic: I am fetching the jnlp file from the server and comparing the timestamp with the current one. if there is diffe...