Skip to main content
michalc81804128
Participant
February 26, 2018
Answered

MouseOver problem

  • February 26, 2018
  • 1 reply
  • 321 views

Hi i want create "hover" efect in my animation, when i go mouse to one elment i want show some images. I'm trying to do it, but something is wrong. Can you look at the code?

this.nota.visible = false;

var frequency = 3;

stage.enableMouseOver(frequency);

this.footer.addEventListener("mouseover", fl_MouseOverHandler_2);

function fl_MouseOverHandler_2()

{

this.nota.visible = true;

}

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

    It's not working because 'this' inside of the function body doesn't refer to the main timeline.

    Try this code:

    var frequency = 3;

    stage.enableMouseOver(frequency);

    this.footer.on("mouseover", fl_MouseOverHandler_2.bind(this));

    this.nota.visible = false;

    function fl_MouseOverHandler_2()

    {

        this.nota.visible = true;

    }

    I hope it helps.

    Regards,

    JC

    1 reply

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    February 26, 2018

    Hi.

    It's not working because 'this' inside of the function body doesn't refer to the main timeline.

    Try this code:

    var frequency = 3;

    stage.enableMouseOver(frequency);

    this.footer.on("mouseover", fl_MouseOverHandler_2.bind(this));

    this.nota.visible = false;

    function fl_MouseOverHandler_2()

    {

        this.nota.visible = true;

    }

    I hope it helps.

    Regards,

    JC