FMX.FlashLight Sample
This is a sample that uses FireMonkey to make your device function as a flashlight.
Contents
Location
You can find the FireMonkeyMobile FlashLight sample project at:
- Start | Programs | Embarcadero RAD Studio Rio | Samples and navigate to:
Object Pascal\Multi-Device Samples\Device Sensors and Services\FlashLight
CPP\Multi-Device Samples\Device Sensors and Services\FlashLight
- Subversion Repository:
- You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
Description
This application shows the use of the TCameraComponent to toggle a device flash.
Note: This application only has effect on an actual mobile device.
How to Use the Sample
- Navigate to the one of the locations given above, and open:
- Delphi: FlashLight.dproj
- C++: FlashLight.cbproj
- Press F9 or choose Run > Run.
Files
The project has one source file, FlashLightU.pas, which contains the main form class.
Classes
TFlashLightForm represents the main form of the application. It contains the following components:
- A TLayout object.
- A TCameraComponent object.
- Four TImage objects:
- FlashLight
- Light
- ImageOn
- ImageOff
Implementation
- The main form contains two TImage objects: ImageOff and ImageOn that are shown or hidden depending on whether the flash is active.
- The flashlight and the light on the screen are also two TImage objects on which two effects are applied: TGlowEffect and TShadowEffect.