Camera.getCamera() Exception when trying to attachCamera ?
Hi,
I try to build a simple Demo of how to use the Camera API with Flex 4.5.1 and AS 3 and Air 2.6 (wether simulating iOS or a real Android HTC Sensation).
The following code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:Button id="button1" x="347" y="289" label="START" width="122" height="42" click="button1_clickHandler(event)"/>
<s:TextInput id="textinput1" x="181" y="349" text="App started"/>
<s:VideoDisplay id="vd" x="244" y="15" width="546" height="417" />
<fx:Script>
<![CDATA[
if(Camera.isSupported) {
trace("Camera erstellt!");
public var myCamera:Camera = new Camera();
}
protected function button1_clickHandler(event:MouseEvent):void
{
myCamera = Camera.getCamera();
if(myCamera) {
textinput1.text ="CAMERA GESETZT!";
myCamera.setMode(420,320,20);
vd.videoObject.attachCamera(myCamera);
}
}
]]>
</fx:Script>
</s:Application>
does not work correctly. If I leave out the "vd.videoObject.attachCamera(myCamera)" I do not get any Exception, but also don't see any Videodisplay or Video of my Camera. If I add it, I get the following Error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
Pointing to the Line of where I use Camera.getCamera()
Main point is that I am not able to see live Video of Camera which I thought should work fine with air for mobile devices?
Planning to do a type of videochat with FMS because of some restrictions to pure Android Code.
