Skip to main content
Inspiring
October 15, 2022
Question

Layer parenting with JSFL

  • October 15, 2022
  • 1 reply
  • 705 views

Is there a way to use JSFL to access layer parenting info? 

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    October 15, 2022

    yes, layers have a parentLayer property.

    Inspiring
    October 15, 2022

    Thanks Kglad. There's nothing about this property online. I'm not in front of An to try it but is it possible to read and set a layer's parent with something like: layer.parentLayer = 3 ? 

    kglad
    Community Expert
    Community Expert
    October 15, 2022

    no.

     

     

    Usage

    layer.parentLayer

     

    Description

    Property;

     

    a Layer object that represents the layer’s containing folder, guiding, or masking layer. The parent layer must be a folder, guide, or mask layer that precedes the layer, or the parentLayer of the preceding or following layer. Setting the layer’s parentLayer does not move the layer’s position in the list; trying to set a layer’s parentLayer to a layer that would require moving it has no effect. Uses null for a top-level layer.

     

     

    Example

    The following example uses two layers at the same level on the same timeline. The first layer (layers[0]) is converted into a folder and then set as the parent folder of the second layer (layers[1]). This action moves the second layer inside the first layer.

     

    var parLayer = fl.getDocumentDOM().getTimeline().layers[0];

    parLayer.layerType = "folder";

    fl.getDocumentDOM().getTimeline().layers[1].parentLayer = parLayer;