Skip to main content
March 5, 2013
Answered

How To Make Text Disappear When Mouse is On a Button?

  • March 5, 2013
  • 1 reply
  • 671 views

Hello,  I'm completely new to Flash and well I need some help. I created a page that has static text in the center.

The page has buttons on side and when I rollover a button text appears, but the problem is that when I rollover a button, the static text in the center is there and I want to hide it as I can't read anything because the texts are overlapped.

How do I make the text in the center disappear/hide when I rollover a button and how do I make it reappear when the the mouse is off the button?

I hope what I am explaining makes sense.

This topic has been closed for replies.
Correct answer Ned Murphy

You can assign onRollOver and onRollOut code to the buttons to make the text dispappear, but you'll need to make the text a movieclip with an instance name that you can use to target it to turn it invisible.  In the simple example below, the button has an instance name of "btn" and the text movieclip has an instance name of "text_mc"

btn.onRollOver = function(){

      text_mc._visible = false;

}

btn.onRollOut = function(){

      text_mc._visible = true;

}

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
March 5, 2013

You can assign onRollOver and onRollOut code to the buttons to make the text dispappear, but you'll need to make the text a movieclip with an instance name that you can use to target it to turn it invisible.  In the simple example below, the button has an instance name of "btn" and the text movieclip has an instance name of "text_mc"

btn.onRollOver = function(){

      text_mc._visible = false;

}

btn.onRollOut = function(){

      text_mc._visible = true;

}

March 5, 2013

Thank you very much! It worked~

Ned Murphy
Legend
March 5, 2013

You're welcome