explorers' club

explorations in dev, science, sci-fi, games, and other fun stuff!

flash.media.Camera.getCamera tip

Leave a comment

[note to self]

When using the Camera, you cannot always expect the default camera object to work when using:

var cam:Camera = Camera.getCamera();

Sometimes you need to access a different camera object in your hardware setup.  This is true when using my MBP, the default DV Camera object just doesn’t work.  Now the API suggests that you can access a camera object name from the array in”

var names:Array = Camera.names;

However trying to access a camera object via this API yields null:

var names:Array = Camera.names;
var cam:Camera = Camera.getCamera(names[i] as String);

instead you must use this syntax:

var names:Array = Camera.names;
//where i is the index, not the array index value
var cam:Camera = Camera.getCamera(String(i));

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s