DS Server

Javascript: TextFrame.setTransparency Method

Method|Introduced in 28.0

Description

Sets the text frame's transparency. It must be a value between 0.0 and 1.0. Zero means opaque and 1.0 means completely transparent.

Syntax

<void> TextFrame.setTransparency(<number> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
value

The new property value.

callback

Optional. Is called when the operation completed.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates TextFrame.setTransparency in a practical document-editing workflow. It sets the text frame's transparency. It must be a value between 0.0 and 1.0. Zero means opaque and 1.0 means completely transparent.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function configureTransparency(textFrame) {
    textFrame.setTransparency(
        1,
        function() {
            console.log("set transparency completed.");
        },
        onTxError
    );
}