Passing variables to and from Adobe Animate

sirwise23 Community Member Posts: 442 ☆ Roadie ☆
Hey everyone,

I know everyone is on the HTML bandwagon now. I am currently working on some course objects that are created in Adobe Animate.

I figure I can Drop the HTML from the animate file into an HTML object and include it in a course. Of course when you did this with a flash object Lectora made it pretty simple to read and write to a variable included in a swf file.

Has anyone had any experience yet with Animate and Lectora and maybe already know what javascript command is needed to read a variable from the files it creates?



  • jvalley4735
    jvalley4735 Community Member Posts: 1,357
    Since Adobe produces HTML 5 and JavaScript and so does can link the two by writing JavaScript in the Adobe HTML that calls out to Lectora.
  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    I guarantee you this works and shouldn't be too hard. You can either call JS from Animate to get/set Lectora variables or run JS in Lectora to get/set variables in Animate.
  • mnotermans5114
    mnotermans5114 Community Member Posts: 916
    to set a Lectora variable named 'mytest' with Javascript:

    To get a Lectora variable named 'mytest' with Javascript:
    var newdata = Varmytest.getValue();
  • mmadrigal3354
    mmadrigal3354 Community Member Posts: 5
    Hello everyone. I've been trying the same communication Lectora with Animate, but I have not succeeded.

    In Animate create a file with the following code:

    var califAnimate = 95;

    This works. If i run the html file sends me the alert with the data (95). This number is the one I want to recover in Lectora. In Lectora i create a new file and on page 1 insert a web window with this file. Also generated a variable that i name as califLectora. Finally i add a OnShow action and run the following js code:


    If I print the value of the variable califLectora in the same (or other) page the result is 0. The question is, how it is addressed or directed towards the web window to take the data directly from there?

    I have tried several tips but I have not gotten it to work.

    Thanks for your help, I will be very useful.

    By the way, sorry for my Google-English.
  • timk
    timk Community Member Posts: 1,207 ♦ Idol ♦
    You should try to set the variable from Animate. As the animation is in a web window it may be necessary to set the variable in the main window. Replace alert(califAnimate); with


    Please mind, I don't know Animate, so I'm not sure, whether this will work.

  • mmadrigal3354
    mmadrigal3354 Community Member Posts: 5
    Hi Tim, had already tried to solve in this way did not work.

    My Animate's file was as follows:
    califAnimate var = 95;
    parent.VarcalifLectora.set (califAnimate);
    alert (califAnimate);

    I did not remove the alert line to check that the file was still working.
    When you run the alert no longer appears. It's funny because if i run the same instruction to display an object of Lectora from Animate works. For example: parent.objectName.actionShow (); it works without a problem.

    I did a similar exercise in js in which put the instruction (VarcalifLectora.set($ counter)) in the js and it worked, the difference with this exercise is not inserted as web window, just run the js directly into Lectora and displays. I do not know what problem is the structure that publishes Animate, which in theory is simple js.

    I will continue investigating and will be aware of yours comments.

    Thanks for the support.
  • timk
    timk Community Member Posts: 1,207 ♦ Idol ♦
    If you don't use the Lectora variable in a Lectora action it won't exist. Just create any action to modify that variable, and the javascript should work.

  • mmadrigal3354
    mmadrigal3354 Community Member Posts: 5
    Hello again!
    It works, just had to do a slightly different procedure.
    Animate´s file has the following code:

    this.stop ();
    var randomNum = Math.round (Math.random () * 100-1);

    / * The instruction parent.VarInLectora.set(AnimateDate) should comment
    if you are going to review the functionality Animate. Remove the comment when published. * /

    if (randomNum <= 79) {
    alert ( "Sorry, you fail Your score =" + randomNum);
    } Else {
    alert ( "Good work !, Your score =" + randomNum);

    Commented lines are because otherwise you can not run and try Animate; exercise does not advance. Once validated proceed to remove the comment lines and publish.

    In Lectora insert the file as web window and load the html, we also include additional files and folders. We also created the califLectora variable. Insert a html extension and the Variables tab include califLectora required.

    That's it, once you load the web window Lectora automatically receives the data from Animate. In a later page I put a text box and a action OnShow that displays the contents of the califLectora variable, which is the same as Animate sent.

    It may not be the best method, but it works. I tested and packaging for LMS and this receives the data correctly Animate-Lectora-AICC_Score-LMS.

    Thus it is very simple, in research to get the answer I found other methods to communicate both programs. I will study more about it.

    Thanks for the support.
  • klaatu
    klaatu Community Member Posts: 988
    Great going, Mario. Another way to access a global variable from Lectora without setting it first in Animate is:


    The ID of the webwidget may have a different number. In the above, myVar1 is the Animate global variable and lecAnimate is the Lecotra variable.
  • sirwise23
    sirwise23 Community Member Posts: 442 ☆ Roadie ☆
    Thanks for the insight guys. I have another question that I was just asked.

    So someone here dropped an Animate Published HTML file into Lectora (P1.html)

    The HTML file auto runs and goes on about its audio and anmiation aspects. Is there a way to pause this? So it creates an HTML object named: webwidget51688.

    Can an HTML object like this actually be paused?