0

I am using Lens Studio from Snapchat.

Right now these are the results it get:

  • 01:38:03 Tap: 5
    01:38:03 Tap: 4
    01:38:04 Tap: 3
    01:38:05 Tap: 2
    01:38:06 Tap: 1

If the user tap one more time it changes to 01:38:03 to Tap: 6

How can i make sure it is displayed as following:

  • 01:38:03 Tap: 1
    01:38:03 Tap: 2
    01:38:04 Tap: 3
    01:38:05 Tap: 4
    01:38:06 Tap: 5

var tap = 0;

function onTapped (eventData)

{ 

    tap++;

   var tapAmount = "Tap: "+ tap;

 print(tapAmount)    

//@input Component.Label label1

script.label1.text = tapAmount;

}

var event = script.createEvent("TapEvent");

event.bind(onTapped); 

My solution was to check how many times the function runned but then i get the same problem...

Thanks for the help!

8
  • 1
    Is print(tapAmount) you printing to the printer?
    – Andy
    Dec 14, 2018 at 0:55
  • @Andy that’s certainly what the print function does in JS anyways. (But you knew that.) w3schools.com/jsref/met_win_print.asp
    – Nate
    Dec 14, 2018 at 0:57
  • @Andy print(tapAmount) is showing it in the console. With the results mention here above.
    – Job
    Dec 14, 2018 at 0:57
  • 1
    @job, no console.log(tapAmount) would do that.
    – Nate
    Dec 14, 2018 at 0:58
  • What is script, and what is script.label1?
    – Nate
    Dec 14, 2018 at 1:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.