Adobe InDesign CS6 (8.0) Object Model JS: Gradient

InDesign CS6

Class

Gradient

 A gradient. Base Class: Swatch

QuickLinks

addEventListener, duplicate, extractLabel, getElements, insertLabel, merge, remove, removeEventListener, toSource, toSpecifier

Hierarchy

Application | Document
Swatch
Gradient
Event | EventListener | GradientStop | MutationEvent

Properties

PropertyTypeAccessDescription
eventListenersEventListeners readonlyA collection of event listeners.
eventsEvents readonlyA collection of events.
gradientStopsGradientStops readonlyA collection of gradient stops.
idnumber readonlyThe unique ID of the Gradient.
indexnumber readonlyThe index of the Gradient within its containing object.
isValidbool readonlyReturns true if the object specifier resolves to valid objects.
labelstring r/wA property that can be set to any string.
namestring r/wThe name of the Gradient.
parentApplicationDocument readonlyThe parent of the Gradient (a Application or Document).
propertiesObject r/wA property that allows setting of several properties at the same time.
typeGradientType:
GradientType.LINEAR
GradientType.RADIAL
r/wThe gradient type.

Methods

Instances

EventListener addEventListener (eventType: string, handler: varies[, captures: bool=false])
Adds an event listener.

ParameterTypeDescription
eventTypestringThe event type.
handlerFile
JavaScript Function
The event handler. Can accept: File or JavaScript Function.
capturesboolThis parameter is obsolete. (Optional) (default: false)

Gradient duplicate ()
Duplicates the Gradient.

string extractLabel (key: string)
Gets the label value associated with the specified key.

ParameterTypeDescription
keystringThe key.

Array of Gradient getElements ()
Resolves the object specifier, creating an array of object references.

void insertLabel (key: string, value: string)
Sets the label to the value associated with the specified key.

ParameterTypeDescription
keystringThe key.
valuestringThe value.

Swatch merge (with: varies)
Merges the specified swatches with the swatch.

ParameterTypeDescription
withArray of Swatches
String
Swatch
The swatches to merge. Can accept: Array of Swatches, Swatch or String.

void remove ([replacingWith: Swatch])
Deletes the swatch.

ParameterTypeDescription
replacingWithSwatchThe swatch to apply in place of the deleted swatch. (Optional)

bool removeEventListener (eventType: string, handler: varies[, captures: bool=false])
Removes the event listener.

ParameterTypeDescription
eventTypestringThe registered event type.
handlerFile
JavaScript Function
The registered event handler. Can accept: File or JavaScript Function.
capturesboolThis parameter is obsolete. (Optional) (default: false)

string toSource ()
Generates a string which, if executed, will return the Gradient.

string toSpecifier ()
Retrieves the object specifier.

Element of

GradientStop.parent

Used in:

Gradient Gradients.nextItem (obj: Gradient)

Gradient Gradients.previousItem (obj: Gradient)

Return

Gradient Gradient.duplicate ()

Array of Gradient Gradient.getElements ()

Gradient Gradients.[] (index: number)

Gradient Gradients.add ([withProperties: Object])

Gradient Gradients.anyItem ()

Array of Gradient Gradients.everyItem ()

Gradient Gradients.firstItem ()

Gradient Gradients.item (index: varies)

Gradient Gradients.itemByID (id: number)

Gradient Gradients.itemByName (name: string)

Array of Gradient Gradients.itemByRange (from: varies, to: varies)

Gradient Gradients.lastItem ()

Gradient Gradients.middleItem ()

Gradient Gradients.nextItem (obj: Gradient)

Gradient Gradients.previousItem (obj: Gradient)

Jongware, 28-Apr-2012 v3.0.3hContents :: Index