Flash Animation Example - Aquarium

16. February 2010

This is a Flash animation created in Adobe Flash CS4 using programmatic techniques in ActionScript 3.0.

 AS3

  • Each part of the fish is a Movie Clip with an associated AS3 class.  The fin and tail movements are simulated using different techniques in AS3.  The eye moves to watch you.
  • Events are implemented for the mouse click and arrow keys using event handlers in the Movie Clips.  Move the fish using the arrow keys.  Click on the fish to release bubbles.
  • The air bubbles in the water are randomly created and given different random upward velocities.
  • The reflection of the fish on the bottom of the aquarium  is simulated by having a fish Movie Clip swim at an offset position to the fish.  The reflection is set to an alpha = 0.1 and scaleX and scaleY are adjusted.
  • Note: simple thing, but give swf focus when page loads using javascript as follows:

// 1. add id="aquariumSWF" to swf Object tag

// 2. add the following Script tag


<SCRIPT language=javascript>
window.onload = function()
{
    var swfObj = document.getElementById('aquariumSWF');
    if ( swfObj )
    {
        swfObj.focus();
    }
}
</SCRIPT>

  John Dorsey
  IT Brigade Inc.
  www.itbrigadeinc.com

Flash , , , ,

Comments