Rotator Applet
Use the Rotator Applet to rotate several banners (up to 99) within a location only large
enough for one. This is useful where you are limited in screen real estate or where you
would like to maximize the effectiveness of one particular "prime" location by rotating
multiple banners in that spot. Rotator can also be used to dynamically create simple
animated text banners on-the-fly, without the need to load image files over the network.
Another potential use for Rotator is to set up a slide show of images.
Applet parameters:
FileName -- specifies the name of the banner manifest file
ScrollDelay -- length of delay (in milliseconds) between banner rotations
Border -- specifies whether or not to put a border around the banners
Author -- if set to "Mark Ganson", suppresses java4free banner insertion
Origin -- if set to "bigfoot.com/~java4free" suppresses java4free banner insertion
JavaScript accessible methods:
document.Rotator.setScrollDelay('010000'); --sets ScrollDelay (must be six digits)
document.Rotator.setBorder('1'); --sets Border parameter to ON ('0' for OFF)
document.Rotator.rotateBanners(); --rotates to the next banner.
Banner Manifest File:
This is a text file you create with a text editor, such as Notepad or DOS EDIT. The
Banner Manifest File tells the Rotator Applet which banner images to use, which URL
links to use when the user clicks the applet, and which message, if any, to display
in the status bar while the banner is being displayed. The Banner Manifest File
can also be used to create simple banners dynamically rather than loading one over
the network, which can be time-consuming.
The format for the BMF file is as follows:
link URL
banner file name
status bar message
Dynamically created banners begin with the keyword "dynamic", followed by the colors
to use for the text lines, followed by the link URL, followed by the text for each line,
followed by the status bar messge, and finished by the scroll delay for this banner (or
frame if animated):
dynamic
line 1 color
line 2 color
link URL
line 1 text
line 2 text
status bar message
scroll delay
Here is the Banner Manifest File (banners.txt) used for this page:
Note: Colors are defined with a six digit hexadecimal value, identical to the format used
in standard HTML. You MUST use six digits. The format is rrggbb, where rr represents the
red component, gg represents the green component, and bb represents the blue component. Be
careful not to leave any extra spaces after the six digits for your colors. End each line
with a hard return.
Scroll Delays are only used for dynamically created banners. The banners you load over the
network from image files will use the global ScrollDelay parameter. The reason you must
specify the scroll delay for dynamically created banners is to allow for the creation of
animated banners. Take care not to leave any extra spaces following these lines. End each
line with a hard return.
When the user moves his or her mouse pointer over the applet, the applet will stop scrolling
banners. This is to prevent the applet from swapping banners unexpectedly just before the
user clicks, thereby redirecting him or her to the wrong URL. The applet will resume the
rotations as soon as the mouse pointer is moved away from the applet. (Animated .gif files
will continue their animations, but dynamically created animated banners will freeze as long
as the mouse pointer is over the applet.)
When the applet is first initialized, it creates an initial banner pointing to my web page
(http://www.bigfoot.com/~java4free). This initial banner will be displayed until all the
other banners are finished loading or until 5 seconds have elapsed, which ever is longer.
After that, the initial banner will be part of the banner rotation and will be displayed
for a period of 5 seconds, regardless of the global ScrollDelay parameter set for your
banners. For example, you could choose to have 5 banners loaded from .gif files over the
network and displayed for a total of 20 seconds each. In such a case, the intial banner
created by the applet will be displayed for as long as it takes to load your 5 banners,
which will vary depending upon the user's hardware and network connection. After your 5
banners have been loaded, the applet will begin rotating them, giving each of them 20 seconds
of exposure. After all 5 have been displayed, the initial banner pointing to java4free will
be displayed for 5 seconds, followed by your banners for 20 seconds each. This loop will
continue until as long as the page is being displayed.
Updated Feature: You can now suppress the java4free banner if you like! To do this,
just add the two (2) following applet parameters: Author and Origin. Example:
Remember, that the longer it takes to load your banners over the network, the longer it will
take for the applet to begin rotating them. Consider creating dynamic banners with the
Banner Manifest File instead, since this will generally be much quicker than loading the
banner image files over the network.
Rotator is not necessarily limited to displaying ad banners. It could easily be used to
present a slide show of image files. To do so, use a very large value for the ScrollDelay
parameter and create a button, such as "next screen" with JavaScript. The onClick function
invoked by clicking the button would be a call to document.Rotator.rotateBanners(), which
would cause the applet to display the next slide.
Here is the HTML code used to put the applet on this page:
Here is a link to the Rotator.class file.
Here is a link to the banners.txt file.
Java4Free! Home