A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Button Code (Help)

  1. #1

    Button Code (Help)

    I'd like to use one button multiple times and when the button is clicked I want it to stay a certain color. How do I do this?

    Example:
    -The button color is gray
    -The button over color is red
    -The button down color is green

    Once a button is clicked, I want the button color to remain green (button down color) until another button is clicked.

    How can I achieve this?

  2. #2
    HELP>>>ACTIONSCRIPT DICTIONARY
    Join Date
    Feb 2000
    Location
    In the Present Moment
    Posts
    1,041
    The way i do it is setup a variable that tracks which button has been clicked. The onRealease function swaps the _name of the button in var currentButton to the new button _name.

    Then I run a function that just "colors" the currentButton which is usually tied into the onMouseOut handler as in the following pseudo code:

    onMouseOut
    if currentButton != this._name
    do rollOut // didn't click it
    else
    doMaintainHighlight // did click it

    This way your normal onRollOver code should still affect the currently selected button.

    Good Luck with your project.
    Antibody
    "Our deepest fear is not that we are inadequate.
    Our deepest fear is that we are powerful beyond measure." - N. Mandela

  3. #3
    Thanks for the post, this sounds like it will do the job, but I'm a beginner and need some some instructions that a bit more basic.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center