DHTML Lab - dhtmlab.com - Dynamic Headline Fader, Version 3.0 | 12
Dynamic Headline Fader, Version 3.0
IEmac 4.0 timer clearing
The Problem
When our Fader has run its course, and all loops are finished, and we stop the repeated calls to
That is,
This bad behavior was fixed in later versions.
This behavior is not perceived by the user, since IEmac 4.0 continues to update the Fader with the final display. Nothing changes on the screen, although resources are being used.
The Solution
We are unable to prevent the repeated calls to
To do this, we first need access to the blendTimer variable from all functions. It therefore gets declared as a global variable, early in our script:
blendTimer = null;
Later,
function FDRstart(ind){ newsCount = ind; if (FDRfinite) loopCount = 0; FDRdo(); blendTimer = setInterval("FDRdo()",FDRblendInt*1000) }
When the Fader has finished looping and
function FDRend(){ clearInterval(blendTimer); blendTimer = null; . . . }
Therefore, when the timer is not being used, that is, before the Fader starts and after it is finished, blendTimer is null.
We can now test for the validity of repeated calls by checking the value of blendTimer. That is, if blendTimer is null, and our loop counter (loopCount) is not zero, it means the Fader should be finished. This test is made in the FDRdo() function, which IEmac 4.0 continues to call, mistakenly:
function FDRdo() { if(!blendTimer && loopCount>0) return; if (FDRfinite && loopCount==FDRmaxLoops) { FDRend(); return; } FDRfade(); if (newsCount == arNews.length) { newsCount = 0; if (FDRfinite) loopCount++; } }
If our test detects that the Fader should be finished, then
There, now IEmac 4.0 should work with our script! So, back to Navigator quirks.
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.Created: Nov 30, 1999
Revised: Nov 30, 1999
URL: https://www.webreference.com/dhtml/column27/fade3iemacintval.html