Skip to main content
sergiopop75
Inspiring
Jun 12, 2022 12:28 PM UTC
Question

Create command to select the layer with a specific name.

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 is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    kglad
    Community Expert
    Community Expert
    Jun 12, 2022 4:50 PM UTC

    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;
    }
    }
    }

    Translate
    sergiopop75
    Inspiring
    Jun 12, 2022 9:00 PM UTC

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

    Translate
    ____2D vector animator since 2000 &amp; PhD
    kglad
    Community Expert
    Community Expert
    Jun 13, 2022 4:02 AM UTC

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

    Translate