1 Reply Latest reply on May 12, 2013 1:04 PM by jbowden

    How do I construct a multi-part variable?

    lanegood

      I am trying to construct a multi-part variable for a url. 

       

      In creationComplete I put this:

       

      sym.setVariable("weekNumber", 3);

       

      sym.setVariable("folder", ["../ea_arguna_t/", "../ea_arneson_l/", "../ea_egan_j/", "../ea_nakahara_s/", "../ea+pilkington_r/", "../ea_sutter_d/"]);

       

       

      on the button click I put this:

       

      var myVariable = sym.getVariable("folder")[0];

       

      var myVariable = sym.getVariable("weekNumber");

       

      sym.setVariable("url", "myVariable"+("week"+weekNumber+".html"));

       

      window.open(sym.getVariable("url", "_self"));

       

      Nothing happens on click.

        • 1. Re: How do I construct a multi-part variable?
          jbowden Adobe Employee

          Your creationComplete code looks okay, as far as Javascript syntax goes. However, there are a couple of problems I can see with your button click code:

           

          1. You've set a variable named myVariable twice, which means only the second assignment will be held. Use a unique variable name for each of these assignments (I'll provide an example below)
          2. You've used setVariable for url, when here you really should be declaring the variable locally using the var keyword. set/getVariable is for setting/getting variables outside of the scope of the button.

           

          Here's how I would write your button click handler:

           

          var pupilURL = sym.getVariable("folder")[0];

          var weekNum = sym.getVariable("weekNumber");

          var url = pupilURL + "week" + weekNum +".html";

          window.open(url, "_self");

           

          hth,

          Joe