Getting Uncaught ReferenceError: camera is not defined
<p>I have JS camera object in codenameone project while I am trying to call that object from a js file its giving me the Uncaught ReferenceError: camera is not defined
error in my chrome browser, while i am trying to upload a image </p>

<p>Below is my codenameone code</p>

<pre><code>camera.set("capture",new JSFunction(){
public void apply(JSObject self, Object[] args) {
Display.getInstance().openImageGallery(new ActionListener(){
@Override
public void actionPerformed(ActionEvent evt) {
String imagePath ="";
if(evt!=null){
imagePath=(String)evt.getSource();
final JSObject uploadedFile = (JSObject)ctx.get("document.getElementById('uploadedFile')");
uploadedFile.set("value",imagePath);
}
}
});
}
});
ctx.set("camera", camera);
</code></pre>

<p>Below is my js file where i am getting error for the camera object I used to give window.camera but at that its giving the same above error for capture where capture is the button id which i am using in my html file.</p>

<p>Below is my js file</p>

<pre><code> document.getElementById('capture')
.addEventListener('click', function(){
camera.capture(function(){
var results = document.getElementById("uploadedFile").value;
document.getElementById("uploadedFile").value=results;
})
}, true);
</code></pre>