In AS3, if you want to attach multiple cameras using Camera.getCamera(name) you can't do so as Camera.getCamera(name) does not seem to work.
However, Camera.getCamera() works fine but it attaches the default camera. But if you want to specify a specific camera to be attached, it does not behave as expected.
var cameranames:Array = Camera.names;
var cam:Camera = Camera.getCamera(cameranames[0]);
cameranames Array gives the names of the cameras detected, but Camera.getCamera(cameranames[0]) returns a null.
Solution for this problem is that you need to pass the index of its position in the Camera.names array instead of the name to getCamera. And the index should be passed as a string. So, the following code will work:
var camera1:Camera = Camera.getCamera("0");
var camera2:Camera = Camera.getCamera("1");
|
My Blog Title
|