Click to return to the DHTML, HTML     
localTime Property     platform Property     Default Behaviors Referen...    
Web Workshop  |  DHTML, HTML & CSS

onOffBehavior Property


Retrieves an object indicating whether the specified Microsoft® DirectAnimation® behavior is running.

Syntax

Scripting [ oOn = ] object.onOffBehavior

Possible Values

oOn DirectAnimation Boolean (DABoolean Non-MSDN link) object that specifies one of the following values:
true Behavior is running.
false Behavior is not running.

The property is read-only with no default value.

Remarks

This property allows you to incorporate multimedia elements, such as 2-D and 3-D animated images and sounds, into an HTML page using the anim:DA element. The object this property is applied to must be an HTML object with a valid HTML+TIME timeline. Use this property with HTML+TIME timelines to control DirectAnimation content. This property is not part of the HTML+TIME specification.

Important  To ensure that pages using this property display properly in future versions of Internet Explorer, complete the following steps:

These actions are necessary only for pages that use HTML+TIME timelines to control DirectAnimation content.

Example

This example attaches a timeline specified with HTML+TIME to an image animated with DirectAnimation. The onOffBehavior property is used to display one image while the animation is running, and to display a different image while the animation is stopped.

Sample Code

<HTML>
<HEAD> 
<TITLE>progressBehavior</TITLE>
<XML:NAMESPACE PREFIX="anim"/>
<STYLE>
.time       { behavior: url(#time); }
anim\:DA    { behavior: url(#default#anim); }
</STYLE>
<OBJECT ID="time" CLASSID="CLSID:476C391C-3E0D-11D2-B948-00C04FA32195">
</OBJECT>
</HEAD>

<BODY>
<P>Initially, an image of the sun is displayed before the DirectAnimation 
behavior starts. Five seconds later a new image replaces the image of the sun. 
The new image fades until it disappears after five seconds of animation. When 
the animation stops, the original image of the sun reappears.</P>
<SPAN ID="spanImg" CLASS="time" t:TIMEACTION="visibility" t:BEGIN="5" 
t:DUR="5">
</SPAN>
<DIV ALIGN="center">
    <anim:DA ID="da1" STYLE="width:504; height:126; z-index: -1;" />
</DIV>
<BR>
<BUTTON onclick="spanImg.beginElement();">Restart</BUTTON>

<SCRIPT LANGUAGE="JScript">
<!--
   // Assign a variable to the DA statics library
   m = da1.statics;
   // Create the DAImages
   img1 = m.ImportImage("/workshop/graphics/solarsys.gif");   
   img2 = m.ImportImage("/workshop/graphics/sun.gif");
   // Display image 1 while the behavior is running, and 
   // image 2 while it is stopped.
   img3 = m.Cond(spanImg.onOffBehavior, img1, img2)
   // Animate the opacity of the image from 100% to 0%, based on the 
   // progress of the time behavior. Use (1 - progress) to get the 
   // proper opacity.
   img4 = img3.OpacityAnim(m.Sub(m.DANumber(1),spanImg.progressBehavior));  
   // Set the image of the DA Object to be the final image behavior
   da1.image = img4;     
//-->  
</SCRIPT>
</BODY>
</HTML>
This feature requires Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
time

See Also

Multimedia Extensions to HTML+TIME, progressBehavior, timelineBehavior


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.