1 Reply Latest reply on Oct 25, 2013 6:30 AM by kemalcomlekci

    Using yepnope, getting error in event handler.

    TyTim

      Recently discover yepnope and started to implement it into my project to keep common functions in one file. The first set of functions worked fine when I moved them over, but with the last one I'm unable to control a symbol.  It's calling the function fine, it's just wont play the symbol timeline.

       

      -------Here's the function in the external file

       

      //Function for audio button

      // Tests the paused attribute and set state.

      voButton = function (){

          if ($('#voiceOver')[0].paused) {

              console.log("play");

              $('#voiceOver')[0].play();

              sym.getComposition().getStage().getSymbol("btnSound").stop(1000);

          }

          else {

              console.log("pause");

              $('#voiceOver')[0].pause();

              sym.getComposition().getStage().getSymbol("btnSound").stop(0);

          }

      };

       

      -------Here's the call to the function

       

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

               voButton();

      });

      //Edge binding end

       

      ------------------------------------

       

      Calling the function plays the audio but doesn't change the symbol. Getting the error message:

      functions.js (line 39)

      Javascript error in event handler! Event Type = element

       

      I've tried different combinations of getComposition() or getSymbol(), nothing.  I read a post somewhere that said I needed to prefix my function creation with sym. and call it the same way.  This didn't work either and caused the function to stop working, but with a new error: sym is not defined in the external file.

       

      Like I said the function works when I call it, but I can't access the symbol's timeline for some reason.

        • 1. Re: Using yepnope, getting error in event handler.
          kemalcomlekci

          I'm trying to include a custom js file to an Edge project, and I'm getting the same "sym is not defined" error. have you found a workaround for this problem?

          can't we just use "sym" or methods like "getSymbol()" in the js loaded by yepnope?

          I can't find any sources about this.

          And I can't find an easy way to substitute "sym"...

          Thanks in advance