Skip to main content
Zipzap32
Known Participant
June 18, 2018
Answered

Comment faire changer une variable a partir d'une animation en HTML5 ?

  • June 18, 2018
  • 4 replies
  • 2405 views

Bonjour a tous et a toutes , j'ai fait une petite animation avec animate CC en html5 et je voudrais faire interagir cette animation avec mon site , en faisant changer une variable php dans la page quand QQn clique sur l'animation.

Une fois j'ai reeussit a ouvrir une page a partir de animate mais c'est tout

Je voudrais que dans animate CC une action sur un objet ou autre fasse changer ma variable dans ma page , la variable "achanger

" et lui donne par exemple la valeur 1 , qqn a une idée ??  merci !

<?php

//achanger c'est la variable qui doit passer à 1 si on clique sur un bouton de l'animation

$achanger = 0;

<div id="logo">

        <object id="EdgeID" type="text/html" width="257" height="170" data-dw-widget="Edge" data="animation_assets/logobis3/Assets/logobis.html">

        </object>

</div>

?>

    This topic has been closed for replies.
    Correct answer avid_body16B8

    I don't use DreawMeaver, so that doesn't tell me much. Since accessing the global variable isn't working, I'm going to guess it's in some kind of nested context. In that case, prefixing the variable reference with parent. in Animate might work.


    I tried that and no joy.

    the OAM file is actually a zipped file. It is inserted as this:

    <object id="EdgeID" type="text/html" width="570" height="420" data-dw-widget="Edge" data="animation_assets/brouillon/Assets/brouillon.html">

    So we need to target the ANCC file through the object I suppose orthe opposition rather. hum...

    4 replies

    Zipzap32
    Zipzap32Author
    Known Participant
    June 21, 2018

    it doesnt work with me , the variable is not setting itself properly between the webpage and the animate CC animation , my purpose was to make it interract , i need a variable to increase or decrease itself , right now the program bugs somewhere

    is there a guide somewhere with animate CC tutorials ? please i need help

    Legend
    June 21, 2018

    I just created an Animate HTML5 movie with nothing but the code alert(test + 1);

    I published it.

    In the generated HTML code, I added the line <script>var test = 1;</script> as the first script tag.

    I ran the HTML document and it displayed 2 in an alert box. No problems.

    avid_body16B8
    Legend
    June 21, 2018

    te problem is that it works if you use the hrml created by ANCC butnot if you have the piece as an object in another hrml file. He is publishing an AOM and adding it as an object in his page. then he wants to communicate betweehn animate and the other html page, not the animate html itself.

    Zipzap32
    Zipzap32Author
    Known Participant
    June 21, 2018

    I think this is better if i speak in english , what i need seems easy to me but i'm stuck , i have a button in my animate CC project , what i want is that this button (once pressed) would change a variable in my html website and increase it by 1

    here is an example : my html file is like :

    ==================================

    body

    <script>

    var test = 0;

    alert test;

    </script>

    /body

    and here is the draft of the animate CC project :

    ======================================

    this.button_1.addEventListener("click", fl_MouseClickHandler.bind(this));

    function fl_MouseClickHandler()

    {

        test = test+1;

    }

    PLEASE help !

    Legend
    June 21, 2018

    Zipzap32  wrote

    here is an example : my html file is like :

    ==================================

    body

    <script>

    var test = 0;

    alert test;

    </script>

    /body

    and here is the draft of the animate CC project :

    ======================================

    this.button_1.addEventListener("click", fl_MouseClickHandler.bind(this));

    function fl_MouseClickHandler()

    {

        test = test+1;

    }

    Yes, that works perfectly.

    Zipzap32
    Zipzap32Author
    Known Participant
    June 21, 2018

    Je vais laisser le php pour utiliser du javascript , si vous pouvez m'aider ca serait sympa , je voudrais faire la meme chose que en haut du topic mais avec du javascript , donc voici mon code :

    <body>

    <script>

            var test = "un super test";

    </script>

    <object id="EdgeID" type="text/html" width="570" height="420" data-dw-widget="Edge" data="animation_assets/brouillon/Assets/brouillon.html">

    </object>

    </body>

    </html>

    Dans animateCC j'ai mis :

    this.button_1.addEventListener("click", fl_MouseClickHandler.bind(this));

    function fl_MouseClickHandler()

    {

        alert(test);

    }

    l'idée c'est que animate et dreamweaver s'échange des informations , qqn peut m'aider svp ??? MERCIIIIIIIIIIII

    avid_body16B8
    Legend
    June 21, 2018

    Bon je vais essayer de vous aider mais je ne promets rien. Je viens de Edge Animate après avoir abandonné FLASH pendant des années et j'ai recommencé d'utiliser ANCC ce mois-ci. La chose dont je ne suis pas sure, c'est le code de DW pour l'objet. Enfin, on verra. Je vous ferais savoir bientôt.

    Zipzap32
    Zipzap32Author
    Known Participant
    June 21, 2018

    merci beaucoups

    kglad
    Community Expert
    Community Expert
    June 18, 2018

    that looks like you're using edge animate, not animate cc.

    Zipzap32
    Zipzap32Author
    Known Participant
    June 18, 2018

    i am using animate CC not edge , why do you say this ? I exported in html format to add it .. really

    kglad
    Community Expert
    Community Expert
    June 18, 2018

    your code shows you're using the edge dreamweaver widget.