I've been attempting to access the mousePressed property within a ProcessingJS snippet, but it keeps returning as undefined
.
Here's my current approach:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="http://cloud.github.com/downloads/processing-js/processing-js/processing-1.4.1.min.js"></script>
<script>
$(document).ready(function() {
$('body').append($('<canvas id="preview"><p>Your browser does not support the canvas tag.</p></canvas>'));
function onPJS(p) {
p.setup = function(){
console.log(p.mousePressed);//returns undefined
try{
console.log(p.mousePressed());
}catch(e){
console.log(e.name,e.message);//displays TypeError Property 'mousePressed' of object [object Object] is not a function
}
}
}
new Processing(document.getElementById("preview"), onPJS);
});
</script>
Can anyone provide insight into what mistake I might be making or what I'm missing?