-
AE2019 – Why does using “index” in an if statement throw an undefined value error?
Trying to use “index” in an If statement seems to throw an error.
This project contains an expression error: error 1 of 1
Error at line 1 in property ‘Opacity’ of layer 3 ‘Maps_AK.ai’ in comp ‘States’. Undefined value used in expression (could be an out of range array subscript?), an expression was disabled as a result of an error.
– Error thrown in both forms of code below. In the 2nd form, 1st line has no error, but uncommenting the second gives the error:
– “index” by itself returns a value (checked with Text layer pick-whipped to the attribute.
– “thisComp.layer(“Control”).effect(“Slider Control”)(“Slider”)” has been pick-whipped from Effect Control.//Both forms of this get same error.
// 1st form...
if (thisComp.layer("Control").effect("Slider Control")("Slider") == index) 100 else 0;
// 2nd form...
selected_state = thisComp.layer("Control").effect("Slider Control")("Slider").value;
if (selected_state == index) 100 else 0;