ArtLayer LayerKind does not work

Upload Photoshop Scripts, download Photoshop Scripts, Discussion and Support of Photoshop Scripts

Moderators: Tom, Kukurykus

GuyOxford

ArtLayer LayerKind does not work

Post by GuyOxford »

Can anyone help me with this. I don't know if this is a bug or if I am doing something wrong.

I am trying to develop a panel using CS Extension Builder ActionScript to make new layers and I can only make the TEXT layer work. This is what I'm doing: -

Code: Select all   var myTextLayerRef:ArtLayer = docRef.artLayers.add();
   myTextLayerRef.kind = LayerKind.TEXT;

And that works fine, creating a text layer. But when I try and create any other type of layer my script crashes. Like this: -

Code: Select all   var myTextLayerRef:ArtLayer = docRef.artLayers.add();
   myTextLayerRef.kind = LayerKind.CURVES;

Anyone any idea? As always, help gratefully received.
GuyOxford

ArtLayer LayerKind does not work

Post by GuyOxford »

I have found a post saying that only kind.TEXT works in CS3. Can someone confirm that this has still not been fixed?
Is there a workaround?

Thanks.
larsen67

ArtLayer LayerKind does not work

Post by larsen67 »

I think you can only set kind to either normal or text

var docRef = app.activeDocument;
var l = docRef.artLayers.add();
l.kind = LayerKind.CURVES;

// results in "You can only change the layer's kind to text or normal"

Solution is probably using action manager code to create the layers… I don't use actionscript so I don't know from experience…
GuyOxford

ArtLayer LayerKind does not work

Post by GuyOxford »

Thanks,

According to the documentation, it is supposed to be possible.

Not sure what you mean by action manager but I'll take a look. I'm guessing you are referring to the codes generated by the script listener.
larsen67

ArtLayer LayerKind does not work

Post by larsen67 »

Yes that is what I mean…
"According to the documentation, it is supposed to be possible."
ah that old chestnut…
Mike Hale

ArtLayer LayerKind does not work

Post by Mike Hale »

GuyOxford wrote:According to the documentation, it is supposed to be possible.

The javascript guide has said that for as long as I can remember. But it is wrong, My guess is the ActionScript guide just copied that mis-information from the javascript guide.

You don't really need LayerKind.NORMAL because that is the default. You can only set the kind to LayerKind.TEXT if the layer is a normal layer that is empty.

I am not sure about CS3 but Flex/Flash panels for CS4 can use Action Manager code.