- September 11, 2020 at 8:24 pm
I’m trying to so something fairly basic but am coming across a repeated issue. I’d like to refer scaling in another Comp, but not choose a specific layer name. Instead I’d like to use the same layer number where I’m calling it from. The error is the same each time “BAD ARGUMENT. LAYER INDEX OUT OF RANGE EXPRESSION DISABLED”
ReadScale=comp(“MyComp”).layer(4).transform.scale //**Works well
ReadScale=comp(“MyComp”).layer(“RefLayer”).transform.scale //**Works well
ReadScale=comp(“MyComp”).layer(thisLayer.index).transform.scale //**Does not work
ReadScale=comp(“MyComp”).layer(x).transform.scale //**Does not work (where “x=5”)
It seems as though no variable can be inserted into this location. I am able to use the following in another expression for a different parameter. But when I put it all together it still does not work.
parseInt((thisLayer.index)-2 //**Works correctly
Any feedback or food for thought would be greatly appreciated!
- September 11, 2020 at 9:17 pm
If I understand correctly – you are trying to use layer 5 in another comp to drive the scale of layer 5 in the current comp? See if this does it:
layerNum = thisLayer.index
refLayerScale = comp(“Comp 2”).layer(layerNum).transform.scale;
[refLayerScale ,refLayerScale ];
- September 11, 2020 at 9:52 pm
Thank you so much for the quick reply! Sorry I add this question to the wrong message board.
I agree that should work but I’m still receiving an error. “Bad Argument: layer index out of range Expression disabled.” I’m glad you’re thinking it should work too, but AE is just telling me no. Is there any reason why this would not work? Neither the one I’ve typed below or written before (using the variable “layerNum”).
refLayerScale = comp(“Comp 2”).layer(thisLayer.index).transform.scale;
The code above does not work, however, changing thisLayer.index to a numeric value does work. So I’m thinking the rest of my equation is good? Feel like I’m missing something else. Any thoughts?
- September 11, 2020 at 10:01 pm
Oh man… I just found the issue. It was pointing to a comp that didn’t have enough layers so it was trying to ref a layer that didn’t exist. Thank you so much!
- September 12, 2020 at 1:07 am
Glad to help!
Log in to reply.