DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


built_in:get_last_image

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

built_in:get_last_image [2015/03/04 16:28] (current)
octazid created
Line 1: Line 1:
 +=====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.
 +
 +<​code>​ app.GetLastImage();</​code>​
 +
 +----
 +
 +====Example====
 +
 +<code javascript>​
 +
 +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 );
 +}
 +
 +</​code>​
  
built_in/get_last_image.txt ยท Last modified: 2015/03/04 16:28 by octazid