I'm starting work on flex using flashbuilder and I was testing cameras. Now I can get a camera to display but when I try using the stop button to stop the camera from capturing, ti doesn't work this is what I tried.
var video:Video;
public function startCamera(muteCam:Boolean=false):void{
video = new Video(); // this will work after the import is done
var camera:Camera=Camera.getCamera();
if(muteCam){
video.attachCamera(camera);
vidHolder.addChild(video);
}else{
video.attachCamera(null);
if(contains(video))
vidHolder.removeChild(video);
//camera=null;
}
}
These are my components
<s:Button x="116" y="28" label="Start" click="startCamera(true)"/>
<s:VideoDisplay id="vidHolder" x="31" y="87" width="200" height="300"
/>
<s:Button id="stop" x="208" y="28" label="Stop" click="startCamera(false)"/>