Table of Contents

GetLastImage

(Information and examples taken from the DroidScript documentation)

Description

The GetLastImage method returns the last image control that was touched by the user. This can be useful when you want to use a single callback function for multiple images.

 app.GetLastImage();

Example

function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
 
  img1 = app.CreateImage( "/Sys/Img/Hello.png" );
  img1.SetOnTouch( HandleImage );
  lay.AddChild( img1 );
 
  img2 = app.CreateImage( "/Sys/Img/Droid1.png" );
  img2.SetOnTouch( HandleImage );
  lay.AddChild( img2 );
 
  app.AddLayout( lay );
}
 
function HandleImage()
{
  var img = app.GetLastImage();
  img.Rotate( 180 );
}