<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d13405220\x26blogName\x3dPavan+Podila\x27s+Blog\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://pavanpodila.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://pavanpodila.blogspot.com/\x26vt\x3d7258010184004836690', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Friday, March 17, 2006

Fun with Flash

I have always found Flash to be a wonderful platform for experimenting with ideas. I used to use javascript earlier, but there if you had to do anything with UI, you had to do some tricky HTML DOM manipulation or use a package like Dojo. Over the past few days I (re)discovered Flash to be a great tool which can come in handy sometimes. With ActionScript 2.0, there is also a pretty rich OO language for creating fairly complex programs (people have written 3D engines in Flash!). I enjoyed tinkering and in the process picked up a little bit of ActionScript 2.0, Math, and Physics concepts!

Here is a small sampling of programs I wrote:
  1. Bounce.swf - simulates some basic forces of gravitation/drag on a ball. You can click and release the ball to give it some speed. The ball bounces around inside a box until it comes to a stop (due to all those forces acting on it).
  2. Tentacles.swf - uses some basic trigonometry and the 2D drawing API of Flash. It simulates an organism which is hyper-active and has some tentacles. You can click to move it. It also tracks your mouse movements. When you click on a new location, the movement has an easing-in effect. The tentacles are beziers with one control point.