Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Move one layer index to a new specified index

Explorer ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

I have a composition. 
I have 300+ layers. I want to take one layer and move it to a different layer index. Seems simple. I tried moveBefore and moveAfter but its not working right.

I call the comp in question and store it as a variable.

Then i call a particular layers index, and then i want to shuffle it to above another layer in the same comp.

    getAComp(compSearchingFor); //this returns mNewComp
    if (typeSelect.selection == 2){ // this is a dropdown that is specified
        myLayer = mNewComp.layer(62); //establish the layer i want to move
        alert(myLayer.name);//alert me just to show this works
        mLayer.moveBefore("Layer name");// i tried this with index too, no luck. the error says mLayer is undefined.
    }

 

TOPICS
Scripting

Views

68

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Explorer , Apr 01, 2021 Apr 01, 2021
solved. I had some bad naming. all good.

Likes

Translate

Translate
Community Beginner , Apr 01, 2021 Apr 01, 2021
First of all:  never hardcode a layer index. If you need to look for a specific control layer, do it by name. Second: Have you tryed to hardcode mNewComp.layer(1)?

Likes

Translate

Translate
Explorer ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

solved. I had some bad naming. all good.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 01, 2021 Apr 01, 2021

Copy link to clipboard

Copied

LATEST

First of all:  never hardcode a layer index. If you need to look for a specific control layer, do it by name. 

Second: Have you tryed to hardcode mNewComp.layer(1)?

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines