Hello everyone,

I'm having a problem with the Camera.getCamera function.

When I use it, I call Camera.getCamera it returns the first camera in my system 
which is a tv card.

So i pass it in the name of my camera 'HP Webcam' and returns null. If I create 
cameras by looping through the camera.names array, each camera is null.

I am slightly confused on this as I have built a component to pick a camera and 
dispatch an event when one has been chosen, then I pick the camera out of that 
via a public var.  but i don't want to have to do this for each time i use the 
camera, i am hoping to save this to a database, (this part is working).

Any help on this will be brill.

Thanks

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; width="400" height="300">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
public var camera:Camera; 
private function list_change(evt:ListEvent):void 
{
var cameraName:String = list.selectedIndex.toString();
camera = Camera.getCamera(cameraName);
dispatchEvent(new Event("CameraChosen"));
}
]]>
</mx:Script>
<mx:Panel id="panel" title="Installed cameras:" 
status="{list.dataProvider.length} camera(s)">
<mx:List id="list" dataProvider="{Camera.names}" width="200" 
change="list_change(event);" />
</mx:Panel>
</mx:Canvas>  

Reply via email to