Justice Chan
Posts: 0
Joined: Mon Apr 21, 2014 11:47 am

Count clicking time

I want to create a button .When I click the button first time, it scans the barcode and runs some JS. Then, click the second time, run some JS and scanning barcode are also. However, It doesn't work on the phone. When I scan first time and complete, then it appears loading. How to fix it? Number is the variable that counting the click and When the barcode service is completed, number++Image Image Image

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Count clicking time

Hi Chan,

Try with another event e.g.: Tap event.

More info about events is here: http://docs.appery.io/documentation/w...

Justice Chan
Posts: 0
Joined: Mon Apr 21, 2014 11:47 am

Count clicking time

I try to use tap event but the problem is still here.. Image

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Count clicking time

What Libraries version are you using and on what device are you testing?

Justice Chan
Posts: 0
Joined: Mon Apr 21, 2014 11:47 am

Count clicking time

galaxy s4 but how to view the libraries?

Justice Chan
Posts: 0
Joined: Mon Apr 21, 2014 11:47 am

Count clicking time

here is the JS Code

var number=localStorage.getItem("number");

if (number==1){
checkcolor();
alert('number1');

}

if (number==2){
checkcolor1();
alert('number2');

}

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Count clicking time

Sorry, didn't notice first time. On service complete event your code:
precodenumber=number+1/code/pre
replace it with:
precodevar new_value = parseInt(localStorage.getItem("number")) + 1;
localStorage.setItem("number", new_value);/code/pre
if you want to increment your local storage variable "number".

Justice Chan
Posts: 0
Joined: Mon Apr 21, 2014 11:47 am

Count clicking time

I try to replace this. The loading dissappear but it only runs

if (number==1){
checkcolor();
alert('number1');
}

but does not run
if (number==2){
checkcolor();
alert('number1');
}
.. Thank you so much!

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Count clicking time

Not sure I understand what you're trying to do. Please clarify the logic and the variable - 'number1'.

Justice Chan
Posts: 0
Joined: Mon Apr 21, 2014 11:47 am

Count clicking time

Oh! Just fill the color by scanning the barcode. Scanning 1 time, fill the color in the top of image. Second time, second image. So I need to count with user click or scanning time. Thank you so much!

Return to “Issues”