4 Replies Latest reply on Mar 5, 2014 4:43 PM by DarthKcaj

    AE expressions- linking text layer to external text array (syntax issue)

    DarthKcaj Level 1

      Hi all,

       

      I am struggleing to solve this-  any assistance would be greatly appreciated.

       

       

      In a text document outside of after effects, I have some arrays stored like 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 my comp in AE, I have one text layer called 'City Picker'. The source text is keyframed to cycle between the array names (eg: 'Los_Angeles', 'Las_Vegas').

       

      I then have many other text layers, with the following expression in the 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 a slider control to call a different item in the array. So simplified, the 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 anybody see what I am doing wrong?

       

      Cheers!