IMS tip: Counters

If you have had a chance to look at our UFO demo using Internet
Explorer 4 or later you will have noticed that this simple game will
keep track of your score. This is accomplished by manipulating an
Object's value.

Counters and their manipulation are specific to IMS Web Engine.
Although it does not matter which Browser you use in order to
manipulate an Object's value, currently only Internet Explorer can
display it.

What are Counters used for?

They are of course a great way to keep track of a user's score when
using IMS Web Engine to create a Web Based game or interactive
presentation. They can also be used to trigger an Object's Behavior.
If you are not yet familiar with IMS Behaviors, see the article we
published a couple of weeks ago at: issue20top3

If you have not yet discovered it, any text Object can be displayed
as a counter by Selecting "Counter" from the dropdown box at the
top right of the text editor. When selected, the text will be treated as
a Title. You can set the Color and Style of a Counter in the same
way you do with a Title Object. When saved, you can scale the
Counter by dragging its bounding box on the Y axis.

When viewed with Internet Explorer, a Counter will display the
current value of its Object. As the value of the Object changes, the
Counter display will also automatically change. By changing an
Object's value, it is possible to display a current score, a math result
or whatever is relevant to an Interactive presentation as a visitor
interacts with it.

How do you dynamically change an Object's value? With a

Every Object is assigned an initial Value of 0. This initial value can
be adjusted in the Object Editor -Options Dialog. To dynamically
change an Object's value, use a Behavior. Is22fig4 illustrates how the mouse
can be used to change the value of on Object by simply clicking on
it. In this very simple example, the Behavior' Formula dialog is used
to adds 1 to the Object each time the visitor clicks on the Object.

A more useful example of a simple counter can be viewed at
europe1 In this example, a counter
will be incremented by one whenever a visitor correctly positions a
European country. When all countries are successfully positioned to
complete the map of Europe, the counter will reach the value of 18
and trigger a Behavior to display a congratulatory message.

Although this Interactive map will work in both Netscape and
Internet Explorer, Netscape will display the original counter text
and not the counter's value. We hope to find a method to
dynamically change a text string in Netscape so that counters can be
displayed in both DHTML Browsers.

Remember that Counters use DHTML. You must use the DHTML
options when Previewing or Publishing a project that includes counters.
In a near future Newsletter we will discuss some more advanced
counter techniques.

"IMS Web Tips" ISSN 1488-7088
© Copyright 1999 Virtual Mechanics

"IMS Web Tips" is a weekly news letter for all web site managers regardless of experience who are looking for detailed information on creating, maintaining and promoting their web sites.
Web Engine
For the best in D HTML editors
Click here for a free WYSIWYG pixel precision HTML editor.
IMS WebTips

Archive by Topic
Archive by Date
Virtual Mechanics