<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic That is cause u have 2 event in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Two-bar-code-scanners/m-p/1071215#M58243</link>
    <description>&lt;P&gt;That is cause u have 2 event handlers already fired and the code is rightly executing both event handlers.&lt;/P&gt;

&lt;P&gt;You can do something like this:&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;&amp;lt;script&amp;gt;

var scan = 0; 
        
function scanNow(){
    scan = 1;
    intel.xdk.device.scanBarcode();
}
        
function scanNow2(){
    scan = 2;
    intel.xdk.device.scanBarcode();
}

document.addEventListener("intel.xdk.device.barcode.scan",function(ted){
    if (ted.success == true) {
        if(scan == 1){
            scan = 0;
            alert("I'm number 1");
        } else if(scan == 2){
            scan = 0;
            alert("I'm number 2");
        }
    }else{
        alert("ERROR");
    }
},false); 

&amp;lt;/script&amp;gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Jan 2016 21:05:48 GMT</pubDate>
    <dc:creator>Rakshith_K_Intel</dc:creator>
    <dc:date>2016-01-04T21:05:48Z</dc:date>
    <item>
      <title>Two bar code scanners</title>
      <link>https://community.intel.com/t5/Software-Archive/Two-bar-code-scanners/m-p/1071214#M58242</link>
      <description>&lt;P&gt;Hello. I'm trying to implement two barcode scanners to two buttons. The problem is that when I click one button or the other, both scripts for the scanners are activated. How to fix that one button uses one script and the other uses the other script?&lt;/P&gt;

&lt;P&gt;Button1:&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;&amp;lt;a class="uib-graphic-button default-graphic-sizing default-image-sizing hover-graphic-button active-graphic-button default-graphic-button default-graphic-text widget uib_w_52 d-margins skenavimo_tekstas media-button-text-bottom" data-uib="media/graphic_button"
                    data-ver="0" id="scan1" style="position: relative; display:block; float:center; width: 10%; padding-bottom: 10%;
    width: 50%; margin: 0 auto; " onclick="scanNow();"&amp;gt;
                        &amp;lt;img src="images/barcode.png"&amp;gt;

                        &amp;lt;span class="uib-caption"&amp;gt;Check&amp;lt;/span&amp;gt;
                    &amp;lt;/a&amp;gt;&lt;/PRE&gt;

&lt;P&gt;Button2:&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;&amp;lt;a class="button widget uib_w_54 d-margins testas icon camera yellow" data-uib="app_framework/button" data-ver="1" id="scan2" onclick="scanNow2();"&amp;gt;Scan&amp;lt;/a&amp;gt;&lt;/PRE&gt;

&lt;P&gt;Here is the first script:&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;&amp;lt;script&amp;gt;
        function scanNow()
            {
                //this function launches the QR Code scanner.
                intel.xdk.device.scanBarcode();
            }
            document.addEventListener("intel.xdk.device.barcode.scan",function(evt){
                if (evt.success == true) {
                    //successful scan
                   alert("I'm number 1");
                }
                else 
                {
                    //failed scan
                    alert("ERROR");
                }
            },false);
    &amp;lt;/script&amp;gt;&lt;/PRE&gt;

&lt;P&gt;And here is the second script:&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;&amp;lt;script&amp;gt;
function scanNow2()
                {
                    //this function launches the QR Code scanner.
                    intel.xdk.device.scanBarcode();
                }
                document.addEventListener("intel.xdk.device.barcode.scan",function(ted){
                    if (ted.success == true) {
                        //successful scan
                    alert("I'm number 2");
                    }else{
                        alert("ERROR");
                    }
                 },false);
        &amp;lt;/script&amp;gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2016 04:28:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Two-bar-code-scanners/m-p/1071214#M58242</guid>
      <dc:creator>Dziugas_S_</dc:creator>
      <dc:date>2016-01-04T04:28:08Z</dc:date>
    </item>
    <item>
      <title>That is cause u have 2 event</title>
      <link>https://community.intel.com/t5/Software-Archive/Two-bar-code-scanners/m-p/1071215#M58243</link>
      <description>&lt;P&gt;That is cause u have 2 event handlers already fired and the code is rightly executing both event handlers.&lt;/P&gt;

&lt;P&gt;You can do something like this:&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;&amp;lt;script&amp;gt;

var scan = 0; 
        
function scanNow(){
    scan = 1;
    intel.xdk.device.scanBarcode();
}
        
function scanNow2(){
    scan = 2;
    intel.xdk.device.scanBarcode();
}

document.addEventListener("intel.xdk.device.barcode.scan",function(ted){
    if (ted.success == true) {
        if(scan == 1){
            scan = 0;
            alert("I'm number 1");
        } else if(scan == 2){
            scan = 0;
            alert("I'm number 2");
        }
    }else{
        alert("ERROR");
    }
},false); 

&amp;lt;/script&amp;gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2016 21:05:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Two-bar-code-scanners/m-p/1071215#M58243</guid>
      <dc:creator>Rakshith_K_Intel</dc:creator>
      <dc:date>2016-01-04T21:05:48Z</dc:date>
    </item>
  </channel>
</rss>

