Skip to main content
VashaLittleMasha
Participant
August 4, 2017
Answered

Why does the mouseover animation through Animate work only once?

  • August 4, 2017
  • 1 reply
  • 347 views

I used this thing in AA:

this.btn.addEventListener("mouseover", over.bind(this));

function over()

{

  this.brt.gotoAndPlay("in");

}

this.btn.addEventListener("mouseout", out.bind(this));

function out()

{

  this.brt.gotoAndPlay("out");

}

At first I had one png and a button I made inside AA, and it worked fine:

https://codepen.io/Pope_Pius_IX/pen/ayBvyM

Then I replaced the button with another png. Since then, the mouseover works only once then doesn't work the second time you hover..

Even after I deleted the second png and returned that button, it still works only once... I only have this original thing on codepen that works properly...

What's going on, I'm so confused!

    This topic has been closed for replies.
    Correct answer VashaLittleMasha

    I started comparing the two js files, and removed one line from the new file and now it works... I DON'T KNOW WHY. This is so strange:

    // Layer 1

       this.instance = new lib.mainbuttonfw();

       this.instance.parent = this;


       this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));


      }).prototype = p = new cjs.MovieClip();

       p.nominalBounds = new cjs.Rectangle(0, 0, 354, 355);

      (lib.bright = function(mode, startPosition, loop) {

       if (loop == null) { loop = false; }                                             //<--  THIS LINE!!!!!!!

       this.initialize(mode, startPosition, loop, { In: 0, Out: 10 });

    1 reply

    VashaLittleMasha
    VashaLittleMashaAuthorCorrect answer
    Participant
    August 4, 2017

    I started comparing the two js files, and removed one line from the new file and now it works... I DON'T KNOW WHY. This is so strange:

    // Layer 1

       this.instance = new lib.mainbuttonfw();

       this.instance.parent = this;


       this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));


      }).prototype = p = new cjs.MovieClip();

       p.nominalBounds = new cjs.Rectangle(0, 0, 354, 355);

      (lib.bright = function(mode, startPosition, loop) {

       if (loop == null) { loop = false; }                                             //<--  THIS LINE!!!!!!!

       this.initialize(mode, startPosition, loop, { In: 0, Out: 10 });

    Legend
    August 4, 2017

    VashaLittleMasha  wrote

    I started comparing the two js files, and removed one line from the new file and now it works... I DON'T KNOW WHY. This is so strange:

    Do not monkey around directly in the generated JS files. The code Animate generates is correct. Yours, apparently, is not. So only mess with the code you've written, in the editor, not in the JS files.

    Republish, open the browser's developer console, and see if it displays any errors.