Quantcast
Channel: Adobe Community : Discussion List - After Effects Scripting
Viewing all articles
Browse latest Browse all 2143

Looping through numProperties always ends with error: undefined

$
0
0

Working on a function that checks wether the selected layer has a specific effect applied to it. Here's a simplified version of it:

 

function hasTransformEffect(layer) {

    for (i = 1; i <= layer.Effects.numProperties; i++) {

        alert(i);

    }

}

 

alert(hasTransformEffect(app.project.activeItem.selectedLayers[0]));

 

When running this, I always end up with an undefined after it's finished looping. Here's a video of me trying this https://streamable.com/bcg48

 

Few things I have tried:

- Using a try/catch to bypass it

- Using an if statement to check wether numProperties > 0 before running the loop

- Running it from Extendscript IDE

- Running it from a saved .jsx file

- Running it on a different machine

- Running it on a different version of AE

 

Wondering what I'm missing, I'm assuming it's something about numProperties that I don't know. Any help is greatly appreciated!

 

Hugo


Viewing all articles
Browse latest Browse all 2143

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>