Page 1 of 2

Count clicking time

Posted: Tue Apr 22, 2014 1:27 am
by Justice Chan

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


Count clicking time

Posted: Tue Apr 22, 2014 1:38 am
by Illya Stepanov

Hi Chan,

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

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


Count clicking time

Posted: Tue Apr 22, 2014 1:45 am
by Justice Chan

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


Count clicking time

Posted: Tue Apr 22, 2014 1:54 am
by Illya Stepanov

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


Count clicking time

Posted: Tue Apr 22, 2014 1:57 am
by Justice Chan

galaxy s4 but how to view the libraries?


Count clicking time

Posted: Tue Apr 22, 2014 2:10 am
by Justice Chan

here is the JS Code

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

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

}

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

}


Count clicking time

Posted: Tue Apr 22, 2014 2:23 am
by Illya Stepanov

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".


Count clicking time

Posted: Tue Apr 22, 2014 2:37 am
by Justice Chan

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!


Count clicking time

Posted: Tue Apr 22, 2014 2:48 am
by Illya Stepanov

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


Count clicking time

Posted: Tue Apr 22, 2014 2:50 am
by Justice Chan

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!