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();
Cycler Methods
Cycler Creates a cycler object. getBvr Retrieves a Behavior object from the array.
Creates a Cycler object.
Syntax
Cycler( Behavior[] arrToCycleThrough, DXMEvent eventToCycleUpon );
Parameters
- arrToCycleThrough
- Array of values cycled through when an event occurs.
- eventToCycleUpon
- Event that causes the Cycler object to cycle through the array of values.
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.
Syntax
public Behavior getBvr( );
Return Value
Returns the Behavior object.
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.