Sunday, February 12, 2012

processing.js change script source


I need to find a way where I can dynamically change the source of a processing script inside an HTML document.



This is the embedded script which works fine:




<script type='application/processing' src='sketch.txt' id="applet">
</script>



Now I try to change the source:




$('#applet').attr('src', 'sketch2.txt');
alert($('#applet').attr('src'));



The alert shows that the source was changed to 'sketch2.txt' but the applet still remains the same. I think I need to refresh the script in some way.



Thank you in advance for any help!

No comments:

Post a Comment