Quantcast
Viewing all articles
Browse latest Browse all 8068

Ti.barcode as JS modul forget overlay

Hi,

I embed the scanner as module:

exports.create = function() {
    var Barcode = require('ti.barcode');
    Barcode.allowRotation = true;
    Barcode.displayedMessage = '';
    Barcode.useLED = true;
    var overlay = Ti.UI.createView({
        backgroundColor : 'transparent',
        top : 0, right : 0, bottom : 0, left : 0
    });
    var cancelButton = Ti.UI.createButton({
        title : 'Abbruch',
    });
    cancelButton.addEventListener('click', function() {
        Barcode.cancel();
    });
    overlay.add(cancelButton);
    Barcode.capture({
        animate : true,
        overlay : overlay,
        showCancel : false,
        showRectangle : true,
        keepOpen : true
    });
    Barcode.addEventListener('cancel', function(e) {
        Ti.API.info('Cancel received');
    });
    Barcode.addEventListener('success', function(e) {
        Ti.API.info('Success called with barcode: ' + e.result);
        Ti.App('tibar:success',{result:e.result});
    });
}
In my view I call the module via:
scanButton.addEventListener('click', function() {
    require('/modules/tibar').create();
});
First time it runs fine. But: If I click in overlay on 'Cancel' the camera overlay is closing. Its OK After reclick on my starter button the camera reappears, but without the overlay … Dont know whats going wrong.

Rainer


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>