DAEvent Class

Creates a DAEvent object that represents an event. Events identify specific times, states or user actions and are used to specify when given actions should occur. Typically, you use events with the Until and UntilEx functions (in the DAStatics class) to create behaviors that change as a result of the event. For example, you can change the color of an object when the user presses a mouse button by using the LeftButtonDown property and the UntilEx function. Every event, when it occurs, returns some event data. This data may or may not be meaningful, depending on the event. For example, LeftButtonDown does not return any meaningful data.

You can combine existing events to create new, more complex events. For example, the AndEvent function in DAStatics lets you combine two events so that the resulting event occurs only if both of the original events occurred simultaneously. The data produced by an event can be examined only within the notifier.

For relevant functions and properties from the DAStatics class, see the following topics.

DAEvent Functions

AttachDataTakes a DABehavior object and produces a new event.
NotifyCreates a new event.
NotifyScript Creates a new event and calls a scriptlet that uses the result as its event data.
ScriptCallbackInvokes VBScript or JScript functions from within animations.
SnapshotWhen called on an instance of a behavior, samples the given behavior and returns it as a constant behavior with the value as data.

AttachData

DAEvent Class

Takes a DABehavior object and produces a new event. The new event occurs at the same time as the original event, but its data is now the data that was specified in the call to AttachData. This allows an application to associate arbitrary client data with an event and know that it will be delivered to the notifier when the event occurs.

Syntax

eventObj.AttachData( data )

Parameters

data
DABehavior object.

Return Value

Returns a DAEvent object. The event data is the event data of the new event.

See Also

IDAUserData

Notify

DAEvent Class

Creates a new event. This occurs when the original event occurs. It then calls the notifier and uses the result as its event data.

Syntax

eventObj.Notify( notifier )

Parameters

notifier
Returns the new behavior.

Return Value

Returns the DAEvent object. The event data is the time the event fired and the new behavior.

NotifyScript

DAEvent Class

Creates a new event that occurs when the original event occurs. It then calls the specified scriptlet and uses the result as the new event's event data.

Note this function can be used only with Microsoft® DirectAnimation® version 6.x or later.

Syntax

eventObj.NotifyScript( scriptlet )

Parameters

scriptlet
A string (BSTR) identifying a scriptlet that returns the new behavior to be used as event data.

Return Value

Returns the DAEvent object. The event data is the time the event fired and the new behavior from the scriptlet.

ScriptCallback

DAEvent Class

Invokes VBScript or JScript functions from within animations.

Syntax

eventObj.ScriptCallback( function, language )

Parameters

function
Function (a string) to be called.
language
Name (a string) of the scripting language.

Return Value

Returns a DAEvent object. When this event occurs, the data it produces has a trivial value.

Snapshot

DAEvent Class

When called on an instance of a behavior, samples the given behavior and returns it as a constant behavior with the value as data. The event time of the new event is when the original event occurs.

Syntax

eventObj.Snapshot( a )

Parameters

a
DABehavior object which will be sampled when the function is invoked.

Return Value

Returns the DAEvent object. The event data is the value of the behavior at the time it was sampled, returned as a constant behavior.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.