2 Replies Latest reply on Sep 30, 2014 6:25 AM by ristenk82

    variable created on click in edgeActions.js but want to reference it in external js file

    ristenk82 Level 1


      Hi, I created a variable on-click in edgeActions.js but want to reference it in external js file. This is where I am at so far:

       

      In my edgeActions.js I st a variable on compositionReady and then use it when I click on the symbol: questionMarkR1. This works fine.. the problem is that I don't know how to reference the variable in my external js file. This first code is working from the edgeActions.js:

       

       

      Symbol.bindElementAction(compId, symbolName, "document", "compositionReady", function(sym, e) {

       

              
               sym.setVariable("questionAsked", false); // sets the initial value

            });

       

      Symbol.bindElementAction(compId, symbolName, "${_questionMarkR1}", "click", function(sym, e) {

       

               var questionAsked = sym.getVariable("questionAsked");
              
               alert(questionAsked);

       

               if (questionAsked)// if true
               {
               sym.$("checkButton2").removeClass( "hidden" );
               sym.$("popUp").removeClass( "hidden" );


               }
               else  //if false
               {

       

               sym.$("pic2a").removeClass( "hidden" );
               sym.$("pic2b").removeClass( "hidden" );
               sym.$("pic2c").removeClass( "hidden" );
               sym.$("pic2d").removeClass( "hidden" );
              
               sym.$("closeBox").removeClass( "hidden" );
               }

            });

       

      This next part doesn't work because I don't know how to reference the variable correctly. This is what I have tried and it doesn't work:

       

           var questionAsked = sym.getComposition().getStage().getVariable("questionAsked");


           alert(questionAsked);