Chuyển tới nội dung chính

GestureRecorder()

The user plays a routine once on their own screen. Every tap, hold and swipe is recorded and passed on to the app, so they can play normally. The answer is a record name for Record:play().

In the Block Editor this is the touch recorder block.

Recording a routine

Constructor​

GestureRecorder(id: number, text: string)
GestureRecorder(id: number, text: string, defaultRecord: string)

Parameters​

ParametersTypeDescription
idnumberThe question's id, for Dialog:getValueById()
textstringThe instruction, such as "Play your route once"
defaultRecordstringOptional. The name of one of your touch records, played until the user records their own

Example​

Dialog:init()
Dialog:add(GestureRecorder(1, "Play your route once"))
Dialog:showIfNeeded()
Record:play(Dialog:getValueById(1))

Notes​

  • The answer is "@dialog/<id>" for the user's recording, or defaultRecord while they use yours.
  • It plays at the pace the user played. See Record:play() for speed and delay.
  • Without a default, the user must record before OK.
  • The recording is saved when the user presses OK. If their screen size changes, the dialog asks them to record again.