Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9257379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:09:27+00:00 2026-06-18T12:09:27+00:00

I have a specific button that included to some states. I must make it

  • 0

I have a specific button that included to some states. I must make it disabled or enabled inside of those states.

But it’s not problem.
Actually the problem is: I have 2 different style classes and I want assign each one of them to enabled or disabled of button, inside the active state.

So I must inside the active state check if now the button is enabled assign the [for example] .red style class to it and if it’s disable, assign the .blue style class.

How can I do it?
Thanks in advance…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:09:28+00:00Added an answer on June 18, 2026 at 12:09 pm

    You should be able to use the dot notationin MXML to accomplish this:

    <s:Button styleNanem.state1 ="red" styleName.state2="blue" />
    

    I’m pretty sure this syntax was introduced in Flex 4.


    If you need to change the button’s state whenever the enabled property is changed, you can loop this up in a function:

    protected function changeButtonState(enabledValue:Boolean, styleName:String):void{
     this.button.enabled = enabledvalue;
     this.button.styleName = styleName;
    }
    

    Instead of setting the enabled property directly, use the above method; and you can determine the styleName based on the state.


    Third update in response to comments on this post

    Almost Every property in the Flex Framework classes dispatches a propertyChanged event when the property changes. So, you can listen, on the button, to the enabledChanged event. The metadata isn’t set up so you’ll have to add the event listener in ActionScript:

    button.addEventListener('enabledChanged',onEnabledChanged);
    
    protected function onEnabledChanged(event:Event):void{
      if(currentState = 'state1'){
        if(button.enabled){
          button.styleName = 'blue';
        } else {
          button.styleName = 'red';
        }
      } else if (currentState = 'state2'){
        if(button.enabled){
          button.styleName = 'green';
        } else {
          button.styleName = 'orange';
        }
    
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my rails 3.1 app, I have specific files that are to be loaded
I have a specific class C and I would like to overload some math
I have a specific case in mind, but the question applies in general too.
I have a specific requirement that all children of a particular JComponent have double
I have a specific question, that could use a general answer... When building Multi-Tier
I've not found anything that addresses my specific name space question as yet. I
I have created a button specific for submitting appeals for punishments. Here is the
Possible Duplicate: Check of specific radio button is checked I have these 2 radio
I have a link that call a specific ajax action and in return it
I'm trying to make an app to control some hi-fi over TCP and have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.