0
I saw on the internet an example to capture photo in the app. I am debugging and appears this error:
Uncaught Referenceerror: takepic is not defined
My code:
function takepic(){
intel.xdk.camera.takePicture(10,true, "jpg");
}
document.addEventListener("intel.xdk.camera.picture.add", function(event){
var nomeFoto = event.filename;
var url = intel.xdk.camera.getPictureURL(nomeFoto);
document.getElementById("ocorrenciaFoto1").setAttribute("src", url);
});
Button that makes the action:
<button onclick="takepic()" class="btn widget uib_w_50 d-margins btn-lg btn-primary" data-uib="twitter%20bootstrap/button" data-ver="1"><i class="glyphicon glyphicon-camera button-icon-top" data-position="top"></i>Foto</button>
What is wrong?
Try putting it on instead of
onclick
in html, a.addEventListener("click", takepic)
on the button, in javascript. It is important the function come without parentheses.– Samir Braga
@Samirbraga you could post the code as it should below?
– Tiago
Of course, it’s not certain to function, but it doesn’t hurt to try.
– Samir Braga