I'm building an android video application on flex mobile that can switch between front and back camera.I wrote a function that switch between the two cameras but it does that only once and when i try to press the button again to switch the camera again it doesn't work and it keeps the front camera.Here is the code that i wrote:
protected function changeCamera(event:MouseEvent):void{
for(var i:int=0;i<Camera.names.length;i++){
var compareCam:Camera;
compareCam=Camera.getCamera(Camera.names[i]);
if(compareCam.name!=camera.name){
camera=Camera.getCamera(compareCam.name);
video.attachCamera(camera);
}
}
Can any one help me please ?