Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Telespielstube
Posts: 15
Registered: ‎07-09-2013
My Device: Z10
Accepted Solution

Enable camera flash

Hi,

 

I wonder how I can enable the flash for camera in Cascades? I do not want to use the camera only the flash, like a flashlight. Do I need to open/close the Camera, though? Or do I access them seperately? I tried the sample app but this is not what I am searching for.

 

my idea:

Camera {
    id: camera
    onFlashMode {
      // code for enabling flash
    }
}

 

Please use plain text.
Developer
slashkyle
Posts: 820
Registered: ‎10-16-2012
My Device: Red Z10

Re: Enable camera flash

not exactly that way... FlashMode is a property of camera settings, so they need to be attached to the camera.

 

Camera {
    id: camera
    objectName: "camera"
    
    attachedObjects: [
    CameraSettings {
    id: settings
    }
    ]
}

 then you can change the flashMode when a button is clicked etc.

camera.getSettings(settings);
settings.flashMode = CameraFlashMode.Off; //On, Auto, Light etc...
camera.applySettings(settings);
console.log("flash mode is: " + settings.flashMode);

 

 

Please use plain text.