Skip to main content
sergiopop75
Inspiring
June 12, 2022
Question

Create command to select the layer with a specific name.

  • June 12, 2022
  • 1 reply
  • 269 views

The layer selection in the history is not reflected and does not allow me to create a command to select a layer with a specific name (for example "eye"). Having this function, it would be useful to select in a character face setup.

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    June 12, 2022

    function selectLayerF(s){

    var tl = fl.getDocumentDOM().getTimeline();
    for(var i=0;i<tl.layers.length;i++){
    if(tl.layers[i].name == s){
    tl.setSelectedLayers(i);
    break;
    }
    }
    }

    sergiopop75
    Inspiring
    June 12, 2022

    Where would I have to change the name for the command to work, e.g. "eye".

    ____2D vector animator since 2000 &amp; PhD
    kglad
    Community Expert
    Community Expert
    June 13, 2022

    don't change anything.  you just call selecLayerF passing the layer name you want selected. eg, selectLayerF("eye")