The Dynamic Layer Object API (DynLayer) is a lightweight object (weighing in at 8 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:
01/24/99 Revisions:
If you send a nestref, it will use yours and double-check it with the DynLayerText() function, so there's basically no way you can get it wrong, and makes this version 100% backward compatible.
The nestref is still there because in certain cases it is necessary like when assigning layers that are in separate frames, or have been pulled into the page from external files, or dynamically created using the createLayer() function. All my widget objects (Scroll, List etc.) have been revamped to remove all nestref work. Please read those sections as well if you are currently using them and want to use the latest version of them.
General Notes:
Noticably absent from the Dynlayer is the browser checking code (ns4 and ie4). There is a reason I am leaving this out of the DynLayer, and why you should not paste it back in yourself. On particular versions of Netscape 4.0 there is a bug associated with setting global variables in js files. What ends up happening is that the first time you visit a page you'll recieve a JavaScript error saying (ns4 not defined) and subsequently another one saying (ie4 is not defined). When you reload the page it'll work fine. This was fixed somewhere along the line, not sure when exactly (4.06??). But all in all, if you want full Netscape 4.0 compatibility, always define the ns4 and ie4 variables in your main document.
For the next update to the DynLayer I will begin incorporating Netscape 5 (Mozilla) hooks so that the DynLayer is at least partially compatible with it. This will still only be experimental as the browser itself is not even near a beta release yet.
I will/plan to make a new browser checking solution and will incorporate it into the DynLayer. I'll probably follow suit with others by making an object named is and have the following properties:
is = new BrowserCheck() is.ns // any version of Netscape is.ns4 // Netscape 4.x only is.ns5 // Netscape 5.x only is.ie // any version of IE is.ie4 // IE 4.x only is.ie5 // IE 5.x only is.v // the exact version of the browser // maybe a few other properties
Home | Next Lesson: DynLayer Extensions |