selector.keys

description

Makes it possible to select the elements by pressing the specified keys. The keys are associated to the element in the order in which they were added, if no shuffle took place in the meantime.

syntax

getSelector(ELEMENT_NAME).keys(key1, key2, ...)
  • key1 :
  • key2 :
  • ... :

example(s)

  • Accepts special keys as arguments as well, such as (Enter, Escape, ArrowLeft, LeftShift, etc).

@newImage("square", "square.png")
@,
@newImage("triangle", "triangle.png")
@    .before( getImage("square") )
@    .print()
@,
@newSelector("shapes")
@    .disableClicks()
@    .add( getImage("square") , getImage("triangle") )
$    .keys(     "F"           ,        "J"           )
@    .wait()
  • Adds two images side by side and waits for a selection by pressing either the F key or the J key.