The Dynamic Layer Object API

The Dynamic Layer Object API (DynLayer) is a lightweight object (weighing in at 9 KB) that provides a highly flexible manner of working with layers. Not only does it have common properties and methods for manipulating layers, it is an object based API which opens up a new way of working with layers that far exceeds the traditional way of coding DHTML. I've found it to be the ideal foundation for nearly every application of DHTML including animation, applications, and gaming environments.

You can add more methods or properties onto it, or remove whatever parts you feel you won't need. Many of the next lessons in this tutorial will use the DynLayer as the basis for accomplishing some other task, so it is important that you understand how it works and how to use it.

Features of the DynLayer Object:

June 23 Changes: Now Using Prototypes

Upon the suggestion from readers of the forum I have moved to using JavaScript prototyping for properties and methods of the DynLayer. I ended up liking it more this way and have made all the methods, even those in the DynLayer Extensions as prototypes as well.

So from now on all DynLayers will automatically have the Slide, Clip, and Wipe methods defined - ie. you never have to call slideInit(), but I have left a blank function in the code so that it doesn't break anything. This is also true for the Wipe, and Glide methods. However I did not change the Geometric objects to do this - you still have to attach those manually.

If you want to use any of the DynLayer Extensions, all you need to do is include the appropriate JavaScript file after the DynLayer file, and all DynLayers that are created will have those methods automatically attached.

The Dynamic Layer Object API

Home Next Lesson: DynLayer Extensions
copyright 1998 Dan Steinman