Skip to main content
Participant
June 22, 2020
Question

HTML5 canvas mouse roll over problem

  • June 22, 2020
  • 1 reply
  • 494 views

Hi guys new to Animate so please bare with me.

 

I am looking to create a trigger when rolled over to play an impoted GIF sequence, which works fine in ActionScript but cannot work out where I am going wrong in HTML5.

 

I have created the sequence code below which works fine 'on click' .

However, instead of 'on click' I need it to function 'on mouse over'

I have been searching YouTube and on here for over 3 hours and my brain is about to explode.

 

Any help would be much appreciated.


/* Stop at This Frame
The timeline will stop/pause at the frame where you insert this code.
Can also be used to stop/pause the timeline of movieclips.
*/

this.stop();

 

/* Click to Go to Frame and Play
Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and continues playback from that frame.
Can be used on the main timeline or on movie clip timelines.

Instructions:
1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.
2.Frame numbers in EaselJS start at 0 instead of 1
*/

this.movieClip_1.addEventListener("click", fl_ClickToGoToAndPlayFromFrame.bind(this));

function fl_ClickToGoToAndPlayFromFrame()
{
this.gotoAndPlay(2);
}

 

    This topic has been closed for replies.

    1 reply

    kglad
    Community Expert
    Community Expert
    June 23, 2020

    stage.enableMouseOver();

     

    this.movieClip_1.addEventListener("mouseover",overF.bind(this));

     

    function overF(){

    this.gotoAndPlay("wherever");

    }

    Participant
    June 23, 2020

    Thank you so much! 

    kglad
    Community Expert
    Community Expert
    June 23, 2020

    you're welcome.