flex - MXML/AS error in Camera.get() -


i new flex/as programming in below code error , how resolve it

     <?xml version="1.0" encoding="utf-8"?>      <mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">        <mx:script>              <![cdata[              import mx.controls.button;              import mx.controls.alert;              import flash.media.camera;               public function clickhandler(event:event):void              {                  var button:button=event.target button;                 if (button.label=='test camera')                 {                        mx.controls.alert.show("starting camera1");                        //mycam = camera.get();                        //myvid.attachvideo(mycam);                        if (camera.names.length > 0) {                           cam = camera.getcamera();                           if (cam != null) {                              try                              {                                 cam.setmode(160,120,8,false); // error here                                 participantvideo.attachcamera(cam);                                 pspublish.attachcamera(cam);                              }                              catch(err:error)                              {                                 alert.show("cannot connect camera");                              }                           }                        }                  ]]>               </mx:script>             <mx:button id="button1" label="test camera" width="100" click="clickhandler(event)" />          </mx:application>          /home/tom/programs/flex/camera.mxml(19):  error: access of undefined property mycam.          cam = camera.getcamera(); 

your code confusing... show error related mycam, mycam commented out!

let's assume error has cam variable. have defined cam?

     private var cam:camera;       //or      var cam:camera = camera.getcamera(); 

check example @ bottom of page attachcamera()

following code...

     private var participantvideo:video = new video( 160 , 120 );       //later in function      participantvideo.attachcamera( cam ); 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -