Back

Event Listener

Even Listener objects using the On method of the Support object:

 sup.On( event name, object, callback );

not: match - btn.On( event name, callback );

Example - Simple

app.LoadPlugin( "Support" );

function OnStart()
{
 lay = app.CreateLayout( "Linear", "VCenter,FillXY" );

 sup = app.CreateSupport();
 
 btn = app.CreateButton( "touch me long", 0.2, 0.1 );
 sup.On( "TouchLong", btn, btn_LongTouch );
 // match: btn.on( "TouchLong", btn_LongTouch );
 lay.AddChild( btn );
 app.AddLayout( lay );
}
function btn_LongTouch()
{
 app.ShowPopup( "Success", "short,bottom" );
}
  Copy   Copy All    Run   

The following event names are available on the On object:

 Touch
 TouchAll
 TouchDown
 TouchMove
 TouchUp
 Drag