javascriptjquery-animateadobeanimate-cc

Animate CC: Creating/accessing global function from external .js file


I need to have a function that is accessed by Animate CC through connecting to an external file by: Global>Includes.

Then I need to run the function that is sitting on the external file when I click on a movie clip.

For example, the code on my movie clip is:

this.stop(); // stops the action on my movie clip

myFunction(); // trying to access function from external javascipt file

The code in the external file is:

function myFunction() { // this code is not being called from my movie clip

alert("working!");

}

The console log states: "myFunction" is undefined.

Thanks for the help,

Kristen


Solution

  • I found out the problem. The animate cc webobject was sitting in the storyline project so the webobject was a child of the parent storyline project and I couldn't get the javascript to work b/w storyline and animate cc until I added parent/child relationships when communicating between the two:

    function myFunction() {
    
        var player = window.parent.GetPlayer();
        var test1 = player.GetVar("pie");
    
        alert(test1);
    
    
    }