User Tools

Site Tools


Privacy Policy


Version 2.50 is out since Jan 1st 2022

Frequently Asked Questions


Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax


Simple Torch

//Called when application is started.
function OnStart()
    //Create a layout
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );    
     //Create Camera view
     cam = app.CreateCameraView( .003,.003 );
     cam.SetOnReady( capture )  
     lay.AddChild( cam )
    //Create a text label and add it to layout.
    txt = app.CreateText( "Torch" );
    txt.SetTextSize( 32 );
    lay.AddChild( txt );
     //Create 'Use Flash' check box. 
    chkFlash = app.CreateCheckBox( "Off" ); 
    chkFlash.SetMargins( 0,0.1,0,0 ); 
    chkFlash.SetOnTouch( chkFlash_OnTouch ); 
    lay.AddChild( chkFlash ); 
    //Add layout to app.    
    app.AddLayout( lay );
   //Start Preview
   function capture()  
//Handle 'Use Flash' checkbox touch 
    function chkFlash_OnTouch(value) 
    if(value==true) chkFlash.SetText("On");
     else chkFlash.SetText("Off");

Home»Sample Code

sample_code/torch.txt · Last modified: 2016/08/29 14:14 (external edit)