• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Can't get the mouse-over mouse-out prewritten codes to work

Community Beginner ,
Jun 23, 2017 Jun 23, 2017

Copy link to clipboard

Copied

Hey, I'm struggling with animate, I'm usually a frame by frame animator but I have to do a UI.

I've created a skitz just to test out how the events work, and I'm already having trouble at step one.

there's a graphical layout and on top of it I've created an invisible button with a hit box, I used this

code to handle the event:

animate1.PNG

/* Mouse Over Event

Mousing over the symbol instance executes a function in which you can add your own custom code.

Instructions:

1. Add your custom code on a new line after the line that says "// Start your custom code" below.

The code will execute when the symbol instance is moused over.

frequency is the number of the times event should be triggered.

*/

var frequency = 3;

stage.enableMouseOver(frequency);

this.button_1.addEventListener("mouseover", fl_MouseOverHandler_3);

function fl_MouseOverHandler_3()

{

  // Start your custom code

  // This example code displays the words "Moused over" in the Output panel.

  this.gotoandplay(113);

  // End your custom code

}

for the mouse over, I don't know why animate says 'this.button_1' since the button I checked while using the code snippet is called 'sirtonim', I tried changing that but when I do, the event doesn't even stop at this frame. (I have another action handling the frame with this.stop();)

I can't get to the mouseout event to test it out, maybe it works maybe it doesn't.

thanks ahead!

Views

505

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jun 23, 2017 Jun 23, 2017

Update: I've fixed the mouseover by adding '.bind(this)' after this.button_1.addEventListener("mouseover", fl_MouseOverHandler_3

but now I've a problem with the mouse out event, it doesn't work.

var frequency = 10;

stage.enableMouseOver(frequency);

this.sirtonim.addEventListener("mouseout", fl_MouseOutHandler_2.bind(this));

function fl_MouseOutHandler_2()

{

  // Start your custom code

  // This example code displays the words "Moused out" in the Output panel.

  this.gotoAndStop(112);

  // End your custom

...

Votes

Translate

Translate
Community Beginner ,
Jun 23, 2017 Jun 23, 2017

Copy link to clipboard

Copied

Update: I've fixed the mouseover by adding '.bind(this)' after this.button_1.addEventListener("mouseover", fl_MouseOverHandler_3

but now I've a problem with the mouse out event, it doesn't work.

var frequency = 10;

stage.enableMouseOver(frequency);

this.sirtonim.addEventListener("mouseout", fl_MouseOutHandler_2.bind(this));

function fl_MouseOutHandler_2()

{

  // Start your custom code

  // This example code displays the words "Moused out" in the Output panel.

  this.gotoAndStop(112);

  // End your custom code

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 23, 2017 Jun 23, 2017

Copy link to clipboard

Copied

LATEST

The problem was that I needed to go one frame earlier, because html5 canvas starts off at zero frames.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines