Skip to main content
Inspiring
November 27, 2006
Answered

Navigation status

  • November 27, 2006
  • 1 reply
  • 150 views
I have several movie buttons. The active button is to have a different color to let the user know where he is currently on the site. Sounds easy right?

I tried this:

var activeButton:String;

buttonOne.onRelease = function():Void
{
[activeButton]button_txt.setTextFormat(normalButton_fmt); //reset previous button to normal look - failure
activeButton = this; //need this to control what button is active (orange) - success
this.button_txt.setTextFormat(activeButton_fmt); //set text to orange...success

<do something>
}

activeButton doesn't work. Is it because I data typed it as a string instead of a movieClip? Does anyone have any example of how they do this? I'm sure there is an easier way.


This topic has been closed for replies.
Correct answer noviceone
Here is the fix:

first, declare activeButton as a movieclip instead of a string

var activeButton:MovieClip;
Then make the following BOLD changes:

buttonOne.onRelease = function():Void {
this_parent[activeButton. _name].button_txt.setTextFormat(normalButton_fmt);
activeButton = this;
this.button_txt.setTextFormat(activeButton_fmt);

<do something>

1 reply

noviceoneAuthorCorrect answer
Inspiring
November 28, 2006
Here is the fix:

first, declare activeButton as a movieclip instead of a string

var activeButton:MovieClip;
Then make the following BOLD changes:

buttonOne.onRelease = function():Void {
this_parent[activeButton. _name].button_txt.setTextFormat(normalButton_fmt);
activeButton = this;
this.button_txt.setTextFormat(activeButton_fmt);

<do something>