## FCurve.GetKeyAtIndex

### Introduced

v3.0

### Description

Returns the key at the specified index.
Note: If the index is out of range then the method raises an 'Invalid argument' (E_INVALIDARG) error.

### C# Syntax

    FCurveKey FCurve.GetKeyAtIndex( Int32 in_Index );

### Scripting Syntax

    oReturn = FCurve.GetKeyAtIndex( Index );

### Return Value

FCurveKey

### Parameters

Parameter | Type | Description
--- | --- | ---
Index | Long | Index of the key. Must be a value between 0 and (number of keys - 1).

### Examples

#### JScript Example

    /*
            This JScript example illustrates how to add keys to an fcurve and
            then how to access the key using its index.
    */
    // Create a null
    Application.NewScene( null, false );
    var nullobj = ActiveSceneRoot.AddNull();
    // Create an fcurve on the posx parameter from the null
    var fc = nullobj.posx.AddFCurve();
    // Define the number of keys
    var nbkeys = 100;
    // Start editing the fcurve
    fc.BeginEdit();
    // Add keys to the fcurve
    var key, val, index, frame;
    for ( frame=1; frame<=nbkeys; frame++ )
    {
            val = ( Math.sin( 1/frame ) * 10 )
            index = fc.AddKey( frame, val );
            // Get key using index
            key = fc.GetKeyAtIndex( index );
            // Lock key
            key.Locked = true;
    }
    // End editing the fcurve and put the undo event onto
    // the undo/redo stack
    fc.EndEdit();

### See Also

FCurveKey.Index FCurve.Keys FCurve.GetKey FCurve.GetKeyIndex