A: 

I don't think there exists a workaround right inside the flash or for any web application as the whole point of security (by restricting access to user's devices) would be lost from that.

As far as I know, the only solution for your problem is to ask the user before prompting the camera detection function.

I might sound like a bummer but something like :

  • Show Dialog "Do you have a camera?" - Yes/No
  • If yes show Dialog "Please grant the flash player to access camera..." - OK
  • Detect Camera (using the getCamera method)
  • If failed show Dialog
  • else start showing all the several dialogs you intended to.

Also sometimes the camera might be present physically & not installed. So if a user does not know or the camera is inaccessible for any reason you might need to figure that out. So for that use

flash.media.Camera.names

and check if it is empty or not. Or better you could simply pull a few bytes of data from the user's camera & see if it really exists & is accessible.

loxxy
I don't see that it defeats security to avoid bothering the user with a prompt about a device they don't have.
Zack
Who said about defeating security. The workaround I proposed is not for the security, its for the job you are trying to accomplish. If flash really had something like that, flash might not have been so popular at all. At least I wouldn't use a thing which allows websites to automatically learn about devices attached to my pc without me not even knowing about the same.
loxxy
+2  A: 

This works with haXe but should be possible with ActionScript 3 too.

if (Camera.names.length != 0) {
  // user has camera
  // this triggers the access dialog
  var camera:Camera = Camera.getCamera();
}
else {
  // user has no camera
}
Hippo
Finally got around to trying this: it works. And also thank you for putting me on to haXe, now I don't have to struggle with the Flash IDE anymore!
Zack
A: 

This might work too: Capabilities.hasVideoEncoder;

The Camera.names.length approach though seems more reliable (as suggested by Hippo).

bigp