DAArray Class

A DAArray object holds other objects that can be selected based on an index that can either vary over time or not. Indexing in the array starts at zero.

This class inherits from DABehavior.

For relevant functions in the DAStatics class, see DAStatics Functions Relevant to DAArray Objects.

DAArray Functions

AddElementAdds a behavior to the end of a DAArray object.
GetElementRetrieves a behavior at the specified array index in a DAArray object.
LengthFinds the length of a DAArray object.
NthAnimSelects a DABehavior object based on the value of a (a DANumber).
RemoveElementRemoves the behavior at the specified array index from a DAArray object.
SetElementAdds a behavior at the specified array index to a DAArray object.

AddElement

DAArray Class

Adds a behavior to the end of a DAArray object. In order to add an element to the end of the array, the array must have been created with DAArray2 or DAArrayEx2 with the DAARRAY_CHANGEABLE flag specified.

Note You can only use this function with Microsoft® DirectAnimation® version 6.x or later.

Syntax

arrayObj.AddElement( bvr , flag )

Parameters

bvr
The DABehavior object to add to the end of the array.
flag
A flag indicating whether time should restart when the new behavior is added to the end of the array. The default, zero, is to restart time. Set to SW_CONTINUE to have the timeline continue without restarting.

Return Value

Returns the index in the array where the new behavior was added. This is one less than the length of the array, since array indexing starts at 0.

Remarks

AddElement is useful when you want to maintain the order of elements in an array. For example, when using OverlayArray the order of the elements in the array matters because they will be overlaid in the order in which they appear in the array, while in UnionGeometryArray order doesn't matter because the new array is the result of the union of all the geometries in the array.

See Also

RemoveElement

GetElement

DAArray Class

Retrieves a behavior at the specified array index in a DAArray object.

Note You can only use this function with DirectAnimation versions later than 6.0; for example, version 6.00.06.xxx or later. Versions with this function are available in Microsoft Internet Explorer 5, Microsoft Windows® 98 Second Edition, and Windows 2000.

Syntax

arrayObj.GetElement( index )

Parameters

index
Integer specifying the index in the array from which to retrieve the DABehavior object. This is one less than the position of the behavior in the array, because array indexing starts at 0. For example, to retrieve the fifth behavior, set index to 4.

Return Value

Returns a DABehavior object at the specified array index.

See Also

SetElement

Length

DAArray Class

Finds the length of a DAArray object.

Syntax

arrayObj.Length( )

Return Value

Returns a DANumber object.

NthAnim

DAArray Class

Selects a DABehavior object based on the value of a (a DANumber). It uses the greatest integer value less than the number's value to determine the index. An array's index begins at 0, and any attempt to index beyond its length results in a run-time error.

Syntax

arrayObj.NthAnim( a )

Parameters

a
DANumber object used as a time-varying index into the array.

Return Value

Returns the DABehavior object.

RemoveElement

DAArray Class

Removes the behavior at the specified index from the DAArray object. In order to remove an element from the array, the array must have been created with DAArray2 or DAArrayEx2 with the DAARRAY_CHANGEABLE flag specified. Indexing in the array starts at 0.

Note You can only use this function with DirectAnimation 6.x or later.

Syntax

arrayObj.RemoveElement( index )

Parameters

index
The position in the array from which the behavior should be removed.

See Also

AddElement

SetElement

DAArray Class

Adds a behavior at the specified array index to a DAArray object. To add an element to the array, the array must have been created with the DAArray2 function or the IDA2Statics::DAArrayEx2 method with the DAARRAY_CHANGEABLE flag specified.

Note You can only use this function with DirectAnimation versions later than 6.0; for example, version 6.00.06.xxx or later. Versions with this function are available in Microsoft Internet Explorer 5, Windows 98 Second Edition, and Windows 2000.

Syntax

arrayObj.SetElement( index, bvr, flag )

Parameters

index
Integer specifying the index in the array where the DABehavior object will be added. This is one less than the position of the behavior in the array, because array indexing starts at 0. For example, to add an element at the fifth position, set index to 4.
bvr
DABehavior object to add to the specified location in the array.
flag
Flag indicating whether time should restart when the new behavior is added to the array. The default, zero, is to restart time. Set to SW_CONTINUE to have the timeline continue without restarting.

Remarks

SetElement enables you to add a behavior to an array at a specific location, unlike AddElement, which adds the behavior to the end of the array.

See Also

GetElement


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