DirectAnimation Animated Header --ModifiableBehavior Class DirectAnimation Animated Header --ModifiableBehavior Class* Microsoft DirectAnimation SDK
*Index  *Topic Contents
*Previous Topic: Model Class
*Next Topic: ModelMakerApplet Class

ModifiableBehavior Class


public class ModifiableBehavior extends java.lang.Object {
    // Constructor
    public ModifiableBehavior(Behavior initialBvr);

    // Methods
    public Behavior getBvr();
    public void switchTo(Behavior newBvr);
}

Provides an asynchronous method of modifying behaviors, often in response to externally generated application events. It is instanced with the new operator, is given an initial behavior, and results in a new behavior for the caller to use. Here is an example:

//...Create a solid color image somewhere in program.
//It will have a switchable color.
ModifiableBehavior sw = new ModifiableBehavior(red);
ColorBvr col = (ColorBvr)(sw.getBvr());
ImageBvr im = solidColorImage(col);

//...somewhere else in program...
sw.switchTo(blue);

Anywhere that col was used will turn from red to blue. In this example, sw contains an untyped Behavior which the example explicitly casts to a ColorBvr. This is necessary because ColorBvr is the type provided as the input to the construction of sw. Calls to switchTo must carry arguments of the same runtime behavior type as the one with which sw was constructed. The replacement behavior begins as soon after the transition occurs as is possible.


ModifiableBehavior Constructor

ModifiableBehavior Class

Use the new operator to construct an instance of the ModifiableBehavior class. Supply an initial behavior and a behavior context.

public ModifiableBehavior(
  Behavior initialBvr
  );

Parameters
initialBvr
The initial behavior.


ModifiableBehavior Methods

bullet1.gifgetBvr

bullet1.gifswitchTo


getBvr

ModifiableBehavior Class

Extracts the Behavior component of the ModifiableBehavior object.

public Behavior getBvr( );

Return Values

Returns the Behavior object.

Remarks

This behavior is subject to the switchTo invocations on the ModifiableBehavior object itself.


switchTo

ModifiableBehavior Class

When invoked, replaces the behavior generated by getBvr to the provided behavior.

public void switchTo(
  Behavior newBvr
  );

Parameters
newBvr
The behavior that is begun once the switchTo method is invoked.
Remarks

Calls to this method must carry arguments of the same runtime behavior type as the one with which the ModifiableBehavior object was constructed. This is an immediate method, which means the new behavior is started when the transition occurs.

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page