2 Replies Latest reply on May 15, 2013 12:38 PM by John Hall

    Another beginner question about targeting functions

    John Hall Level 4

      I've read what I thought was an excellent thread about scope in EA, but I'm still not getting some of the basics (btw the thread was http://forums.adobe.com/message/5287753#5287753).

       

      I have "slides" in the symbol library and in the main composition compositionReady script I've set up a generic script for playing back sound. That script works fine when I bind it within the compositionReady script to a symbol and click, so I know the funciton itself is fine. My question, I'm programmatically loading the slides from the library as I go along and want to use the generic function I created in the compositionReady script, but I can't seem to create the proper syntax to call the script. Here's some that I have tried. What is the correct syntax? The script is on frame inside the slide symbol.

       

       

      //sym.getComposition().getStage().playSound();

      //sym.getComposition().playSound();

      //Edge.getComposition("CER_1").playSound();

        • 1. Re: Another beginner question about targeting functions
          TimJaramillo Level 4

          Hi John,

           

          I haven't called a function from a dynamic symbol, so I'm not 100% sure, but can you confirm that the frame script is running, in your dynamic symbol? Put a console.log('test'); right before your nested function call to make sure that frame script is running. (Maybe the playhead is never reaching the frame script, etc.)

          • 2. Re: Another beginner question about targeting functions
            John Hall Level 4

            Thanks for having a look. Yea, it's getting to the script fine but it doesn't like the syntax. Console always indicates javascript error, which is what happens when Edge throws an exception because it doesn't know what to do. The article that Elaine posted on above gives me the sense that it might be best to change the function to a variable, then it would be in scope to call but I have parameters I'd like to pass with it and I don't think  I can pass a parameter with to a variabalized (word?) function. I know it's just me moving from ActionScript to Edge JavaScript and scope. Whereas I could always find a homebase in ActionScript with the stage, it seems that the stage in Edge is just another symbol and calling a function within the stage is never getting there. Elaine hints at putting outside the stage closure and it would be accessible, which, of course, has led me to start readying JavaScript books and learning more about scope etc. It seems like that is life as a developer. I  dont' get that, oh, better take a day or two to  understand that concept, oh, that function works now, next problem. ;-)