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:
/* 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!
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
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
Copy link to clipboard
Copied
The problem was that I needed to go one frame earlier, because html5 canvas starts off at zero frames.