Macromedia Flash Server - Camera.done();

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > June 2005 > Camera.done();





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Camera.done();
Bill Sanders

2005-06-18, 7:45 am

After thinking about the question of turning off a Camera, I gave it
a test, and it worked as I expected (but not, perhaps, as I
explained.) The Camera object is simply selected as an input source.
The default of Camera.get() is actually Camera.get(0). In dealing
with multiple cameras (if you ever doing any security applications,
you're likely to encounter this) the first camera selected is 0, the
second is 1, etc. (Ch 6 by Joey Lott in the PFCS book is a great
resource for this.) In a wild guess, I assumed that Camera.get(null)
would effectively select no camera and turn off any selected camera.
That's exactly what happens. I set up the following little test using
3 buttons and two cameras, one of which has a red light indicating
that it is "on." The trick would be to see if it could be turned on
and off by selecting and de-selecting it with a second camera and a
Null camera.

var cam1 = Camera.get(0);
var cam2 = Camera.get(1);
var camNull = Camera.get(null);
var vid:Video;
function doCam(cam:Camera) {
vid.attachVideo(cam);
}
b1_btn.onPress = function() {
doCam(cam1);
};
b2_btn.onPress = function() {
doCam(cam2);
};
b3_btn.onPress = function() {
doCam(camNull);
};

To make a long story short, it did de-select the camera and
effectively turned it "off" as the input camera. To turn your camera
off and clear the video try the following function:

function CameraDone(cam,vid) {
cam=Camera.get(null); //Cam is the instance name of any
currently select camera
vid.attachVideo(cam); //Vid is the instance name of the video
}

HTH,
Bill



bill sanders | www.sandlight.com | bloomfield, ct | 860-242-2260


=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com