PSCS Layer Opacity Property 100%

A Listing of Confirmed Scripting Bugs and Anomalies - Open to all but only moderators can post

Moderators: Tom, Kukurykus

xbytor

PSCS Layer Opacity Property 100%

Post by xbytor »

Let's assume we have a layer in a doc at a default opacity of 100%. There is a problem that can occur if you set the value of the opacity to 100 via a variable. It works ok if you set the value to 100 via a literal constant:

Code: Select allvar doc = app.activeDocument;
var layer = doc.activeLayer;

// displays "100"
alert(layer.opacity);

//  Error: Specified value greater than maximum allowed value
layer.opacity = layer.opacity;

// OK
layer.opacity = layer.opacity.toFixed();

// OK
layer.opacity = 100;