Hi,

I have to be able to turn on and off my webcam.
I mean to be able with a simple check box to start capturing and to stop
capturing video from a webcam.

I'm able to start the capture but I can't find the way to stop it when I
press the button.

Find below the code. 
I have tried many things in the function deleteCam.
The only test doing something is my_video.clear(); but this is just deleting
one frame and not the Camera on Video objet.
I haven't found anything else in the documentation.

The video object "my_video" is on the stage.

What am I missing ....

Thanks,

++++++++++++++++++++++++++++++++++++++++

var my_cam:Camera;
var my_video:Video;

//
var camera_lbl:mx.controls.Label;
var cameras_cb:mx.controls.ComboBox;
camera_lbl.text = my_cam.name; 
cameras_cb.dataProvider = Camera.names;
function changeCamera():Void {
    my_cam = Camera.get(cameras_cb.selectedIndex);
    my_video.attachVideo(my_cam);
    camera_lbl.text = my_cam.name; 
}
cameras_cb.addEventListener("change", changeCamera);
camera_lbl.setStyle("fontSize", 9);
cameras_cb.setStyle("fontSize", 9);
//
//
var VideoTrigger_o:Object = new Object();
VideoTrigger_o.click = function(event_obj:Object) { 
    if (VideoOnOff_c.selected){
            activateCam_f();
        } else if (!VideoOnOff_c.selected){
                deleteCam_f();
        }
};
//
//
VideoOnOff_c.addEventListener("click", VideoTrigger_o);
function activateCam_f():Void { 
    my_cam = Camera.get();
    my_video.attachVideo(my_cam);
}
//
//
function deleteCam_f():Void{
    //delete my_cam;
    //delete my_video;
    //my_video.close() ;
    //my_video.pause();
    my_video.clear();
}


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to