AE expressions- linking text layer to external text array (syntax issue)
hi all,
i struggleing solve this- assistance appreciated.
in text document outside of after effects, have arrays stored this:
var los_angeles = ["los angeles", "city type:", "multi-city", "geo:", "-115.180664062,36.111252521", "languages:", "31", "poi count:", "20", "photo count:", "600", "video", "y", "video views", "30,200"];
var las_vegas = ["los vegas", "city type:", "multi-city", "geo:", "-118.243684900,34.052234200", "languages:", "29", "poi count:", "20", "photo count:", "331", "video", "y", "video views", "26,000"];
var sydney = ["sydney", "city type:", "multi-city", "geo:", "151.204250000,-33.866850000", "languages:", "29", "poi count:", "20", "photo count:", "331", "video", "y", "video views", "26,000"];
in comp in ae, have 1 text layer called 'city picker'. source text keyframed cycle between array names (eg: 'los_angeles', 'las_vegas').
i have many other text layers, following expression in source text parameter-
try{
mypath = "/volumes/video master/videos/find yours project b0ss/source.txt";
$.evalfile(mypath);
eval(thiscomp.layer("city picker").text.sourcetext)[math.round(effect("slider control")("slider"))];
}catch(err){
"missing";
}
each text layer has slider control call different item in array. simplified, 4th line of code should read-
eval(arrayname)[item number]
eg: eval(sydney)[5] should return 'languages:'
however, instead of that, when
eval(sydney)[5] returns 'y'
eval(los_angeles)[5] returns 'n'
eval(los_angeles)[3] returns '_'
can see doing wrong?
cheers!
$.evalfile(mypath); evaluates source.txt, , declares arrays inside expression.
past point no longer need eval anything.
just use arrayname[item number] instead of eval(arrayname)[item number].
for instance sydney[5], return 'languages:'
xavier
More discussions in After Effects
adobe
Comments
Post a Comment