Skip to main content
ppcahill
Participant
July 24, 2020
Question

mouseover javascript not working for me

  • July 24, 2020
  • 1 reply
  • 224 views
I've successfully created a button that changes color when I hover and when I click it goes to a website.  Next, I want a mouseover of this same button to make another image come up and go away when the mouse leaves.  When I add the code for this, it doesn't work.  It worked fine in Action3.0.  I don't know what I'm doing, but how can I fix this code so it will work please? 
 
 
/* Click to Go to Web Page
Clicking on the specified symbol instance loads the URL in a new browser window.
 
Instructions:
1. Replace http://www.adobe.com with the desired URL address.
   Keep the quotation marks ("").
*/
 
this.btn_1mc.addEventListener("click", fl_ClickToGoToWebPage);
 
function fl_ClickToGoToWebPage() {
}
 
/* Show an Object
Shows the specified symbol instance.
 
Instructions:
1. Use this code to show objects that are currently hidden.
*/
 
this.mc_flyout_1.visible = false;
 
 
 
 
/* 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.btn_1mc.addEventListener("mouseover", fl_MouseOverHandler_5);
 
function fl_MouseOverHandler_5()
{
// Start your custom code
// This example code displays the words "Moused over" in the Output panel.
mc_flyout_1.visible = true;
// End your custom code
}
 
/* Mouse Out Event
Mousing out of 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 out of.
*/
var frequency = 3;
stage.enableMouseOver(frequency);
this.btn_1mc.addEventListener("mouseout", fl_MouseOutHandler_5);
 
function fl_MouseOutHandler_5()
{
// Start your custom code
// This example code displays the words "Moused out" in the Output panel.
mc_flyout_1.visible = true;
// End your custom code
}

 

    This topic is closed to new replies. Start a new post to keep the conversation going.

    1 reply

    kglad
    Community Expert
    Community Expert
    July 25, 2020

    use:

     

    this.btn_1mc.addEventListener("click", fl_ClickToGoToWebPage);
     
    function fl_ClickToGoToWebPage() {
    }
     
    var frequency = 3;
    stage.enableMouseOver(frequency);
    this.btn_1mc.addEventListener("mouseover", fl_MouseOverHandler_5.bind(this));
     
    function fl_MouseOverHandler_5()
    {
    this.mc_flyout_1.visible = true;
    }
     
    this.btn_1mc.addEventListener("mouseout", fl_MouseOutHandler_5.bind(this));
     
    function fl_MouseOutHandler_5()
    {
    this.mc_flyout_1.visible = false;
    }