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

AppTriggeredEvent Class

Constructor , Methods

public class AppTriggeredEvent extends DXMEvent {
     // Constructor
     public AppTriggeredEvent(BehaviorCtx ctx);    

     // Methods
     public void trigger();
     public void trigger(Behavior eventData);

Creates the event. The event can be used in the until and untilNotify methods to create reactive behaviors based on external events.

In the following example, a cube turns from red to blue, based upon some external application event:

//Turn a cube from red to blue when an external event occurs
//The following code is a fragment from some larger program
//Get the cube
GeometryBvr cube = importGeometry("cube.wrl");
//Create the external event
AppTriggeredEvent appEvent = new AppTriggeredEvent(BehaviorCtx ctx);
//Set up the color of the cube -- red until the event, then blue
ColorBvr col = (ColorBvr)until(red, appEvent, blue);
//Map the color to all points of the cube
GeometryBvr coloredCube = cube.diffuseColor(col);

//...elsewhere, when the application receives the event...
appEvent.trigger();

//...now coloredCube (assuming it's running) will turn blue


Constructor


AppTriggeredEvent

public AppTriggeredEvent (BehaviorCtx ctx);    

Constructs an AppTriggeredEvent object.

ParameterDescription
ctx Contains state information (such as the view).


Methods


trigger

public void trigger();

Triggers the event.

Remarks:

The triggered event occurs as soon as possible.


trigger

public void trigger(Behavior eventData);

Triggers the event and passes the given data to the event handler or notifier.

ParameterDescription
eventData An object that contains any data representing the event.

Remarks:

The triggered event occurs as soon as possible.



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