4,203 views 3 comments

Javascript to AS3 – Blobby blobby

Ever since I saw Jeff Han’s lava lamp multitouch demo, I’ve been interested in ‘blobs’ or ‘meta-balls’. There’s a great new HTML5/javascript demo of interacting with blobs (moving, splitting, merging, etc) http://hakim.se/experiments/html5/blob/03/.

[kml_flashembed publishmethod=”static” fversion=”8.0.0″ movie=”http://sethsandler.com/files/blobs.swf” width=”500″ height=”380″ targetclass=”flashmovie”]

Get Adobe Flash player

[/kml_flashembed]

The code is opensource under a MIT license so I decided to try porting the little application over to actionscript 3 to see how straight forward it is to port from javascript to as3.I know the trend is moving the opposite way – AS3 -> html5/js, but this is more a proof of concept of how easy it can be to move from one to the other. After about 2 hours messing around, I was able to port 90% (minus the window interaction and skinning). 85% of the code I didn’t have to change at all and was able to copy/paste straight from the javascript code.

Here’s the results below…

Version 2:

[kml_flashembed publishmethod=”static” fversion=”8.0.0″ movie=”http://sethsandler.com/files/blobs2.swf” width=”500″ height=”380″ targetclass=”flashmovie”]

Get Adobe Flash player

[/kml_flashembed]

Version 3:

[kml_flashembed publishmethod=”static” fversion=”8.0.0″ movie=”http://sethsandler.com/files/blobs3.swf” width=”500″ height=”380″ targetclass=”flashmovie”]

Get Adobe Flash player

[/kml_flashembed]

This could be extended by adding multitouch and making  the dragging more consistent.

Did you enjoy this post?

Comment Below , Follow Me on Twitter , Follow Me on Facebook , or Network with Me on Linkedin

-->