Skip to main content
Participant
August 5, 2021
Question

AE Moving layer error 'Can not “set value” with this property

  • August 5, 2021
  • 2 replies
  • 318 views

In AE I'm getting the error 'Can not “set value” with this property, because the property or a parent property is hidden.' 

When trying to move a layer like this:

    var theComp = app.project.activeItem;
    for (var i = 1; i <= theComp.numLayers; i++) {
        var curLayer = theComp.layer(i)
        if (!curLayer.parent) {
            var layerPos = curLayer.transform.position.value;
            $.writeln("pos: ")
            $.writeln(layerPos[0] + ", " + layerPos[1] + ", " + layerPos[2])
            var moveX = 285
            var moveY = 239
            curLayer.transform.xPosition.setValue(layerPos[0] - moveX);
            
    
        }

    }

I am getting the same error as in https://community.adobe.com/t5/after-effects/after-effects-error-can-not-set-value-with-this-property-because-the-property-or-a-parent-property/td-p/10560938 

even though it seems like I am using the solution from that answer. 


Any idea what I might be missing?

 

This topic has been closed for replies.

2 replies

Mathias Moehl
Community Expert
Community Expert
August 5, 2021

Additional remark: If you want your code to work with both layers whose dimensions are separated AND layer where this is not the case, make sure to check position.dimensionsSeparated to know if the dimensions are separated or not (and then set either the position or the x and y position props accordingly)

https://ae-scripting.docsforadobe.dev/properties/property/#property-dimensionsseparated

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Bjorn5FEFAuthor
Participant
August 5, 2021

I copied the code from the other answer and it magically worked. So no need to reply. Thank you.