DirectX Media for Animation Java Reference Previous
Previous
Classes
Classes
Index
Index
Next
Next

Cycler Class

Constructor , Methods

public class Cycler extends java.lang.Object {
    // Constructor
    Cycler(Behavior[] arrToCycleThrough, DXMEvent eventToCycleUpon);

    //Methods
    public Behavior getBvr();

The Cycler object cycles through an array of values when an event occurs. Here is an example that cycles through the colors red, green, blue, yellow, red, green, and so on, each time the left mouse button is pressed:

//Cycle through a series of colors
//Create the array to contain the values
Behavior behavior[4] = {red, green, blue, yellow};
//Construct Cycler object
//Associate values in array with the left mouse button event
Cycler cyl = new Cycler(behaviors, leftButtonDown);
//Set the color equal to the next value in the array
ColorBvr col = (ColorBvr)(cyl.getBvr());

The following example cycles through an array of sounds:

//Create an array of sounds
Behavior[]snds = {snd1, snd2, snd3};
Cycler cycle = new Cycler(snds, leftButtonDown);
SoundBvr currentSnd = (SoundBvr)(cycle.getBvr();


Constructor


Cycler

Cycler(Behavior[] arrToCycleThrough, DXMEvent eventToCycleUpon);

ParameterDescription
arrToCycleThrough The array of values cycled through when an event occurs.
eventToCycleUpon The event that causes the Cycler object to cycle through the array of values.


Methods


getBvr

public Behavior getBvr();

Retrieves a Behavior object from the array. The behavior that is returned doesn't itself respond to the provided event. The behavior must be running before the events can have any effect.

Return Value:

Returns the Behavior object.



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.