Skip to main content
Inspiring
Oct 15, 2022 5:01 AM UTC
Question

Layer parenting with JSFL

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

    This topic is closed to new replies. Start a new post to keep the conversation going.

    5 replies

    kglad
    Community Expert
    Community Expert
    Oct 15, 2022 1:41 PM UTC

    yes, layers have a parentLayer property.

    Translate
    Inspiring
    Oct 15, 2022 6:42 PM UTC

    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 ? 

    Translate
    kglad
    Community Expert
    Community Expert
    Oct 15, 2022 6:54 PM UTC

    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;

    Translate