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

Change overall tintColor and font-size of UITableViewCellStyleValue2 textLabel in iOS 7

ios uitableview ios7 tintcolor

I have a Skinning module where I define my app wide tintColor for general use in the app:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.