\n'); } //-->
|
|
Flash to Processing Communication I like Processing for its speed. You can do way more fancy stuff on a pixel level than in Flash. Though there is one thing about Processing which is less optimal and that is: user interfaces. Yes, you can build your own, but unfortunately it's not as confortable as in Flash, plus it drains the performance. So this is my first attempt to establish a communication between a Flash user interface and a processing render engine. Of course this goes via Javascript which will probably mean that it does not work on certain browser/OS combinations. Note: It seems like this currently works only in Internet Explorer There might be some synchronization issues, but in general it seems to be a possible way. As I did not include the fla file, here is the source code that handles the communication via FSCommand to JavaScript:
function onSlider(slider) {
var v = Math.round(slider.getValue());
if (v != this.lastV) {
this.lastV = v;
blur_txt.text = "Blur Radius: "+v;
clearInterval(this.sID);
this.sID=setInterval(this,"sendSlider",100,v);
}
}
function sendSlider(v){
clearInterval(this.sID);
fscommand("onSliderChanged", v);
}
As the slider component sends a lot of events whilst dragging I added a little buffer that reduces the amount of calls to the Processing applet.
Built with Processing |