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 7703835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:32:57+00:00 2026-05-31T23:32:57+00:00

I have a custom component called ButtonPanel written in Actionscript. Basically it’s just a

  • 0

I have a custom component called ButtonPanel written in Actionscript. Basically it’s just a panel that displays a mx:ButtonBar in the upper right of the mx:Panel title bar and responds to the clicks of the buttons in the bar.

A ButtonBar has three styles available for the buttons: buttonStyleName, firstButtonStyleName, and lastButtonStyleName. I want to write these styles for the ButtonPanel so that if it is declared as such:

<comp:ButtonPanel buttonStyleName="myButtonStyle" ... />

then the ButtonPanel will pass the style through and set the corresponding style of the ButtonBar.

I really have no clue where to start on this because I’ve never messed with defining styles. Can someone help?

  • 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-05-31T23:32:58+00:00Added an answer on May 31, 2026 at 11:32 pm

    What you refer to as “pass-through” styles are actually called inheriting styles. The solution to your question is in fact quite simple.

    You use the style metadata on your custom component to declare that ButtonPanel has a stylename called ‘buttonStyleName’:

    [Style(name="buttonStyleName", inherit="yes")]
    
    public class ButtonPanel extends Panel {
         ....
    }
    

    Note the ‘inherit’ flag which is set to true: this will make sure that any component inside your custom Panel that has the same style will inherit the value that you’ve given to that style at the Panel level.

    Setting this metadata will make sure that FlashBuilder will suggest buttonStyleName as a style and not as a property (as would happen with Sam’s solution).


    Edit: already defined styles

    I didn’t realize at first that you were referring to the mx ButtonBar (as it’s not explicitly mentioned). The reason this is not working for you is that mx:ButtonBar already has these styles defined as not inheriting. Look at the source code:

    [Style(name="firstButtonStyleName", type="String", inherit="no")]
    [Style(name="buttonStyleName", type="String", inherit="no")]
    [Style(name="lastButtonStyleName", type="String", inherit="no")]
    

    Because of this the compiler will complain when you try to override that definition in your custom Panel, because it simply wouldn’t know which of the contradictory instructions to pick. So we’ll have to do a little more work if you want to stick with mx:ButtonBar.

    First define the styles on ButtonPanel exactly as they are defined in mx:ButtonBar so they have the same signature (you can just copy/paste the three lines above). This will shut up the compiler but the styles won’t be inherited anymore, right?

    So we’ll have to pass them on manually: in your custom Panel skin, override the updateDisplayList() method and – assuming that the ButtonBar’s id is ‘buttonBar’ – add the following:

        private const buttonStyles:Array = [
            "firstButtonStyleName",
            "buttonStyleName",
            "lastButtonStyleName"
        ];
    
        override protected function updateDisplayList(unscaledWidth:Number, 
                                                      unscaledHeight:Number):void 
        {
            if (buttonBar) 
                for each (var buttonStyle:String in buttonStyles)
                    buttonBar.setStyle(buttonStyle, getStyle(buttonStyle));
    
            //some other code
    
            super.updateDisplayList(unscaledWidth, unscaledHeight);
        }
    

    This will take the styles from the host Panel and pass them on to the ButtonBar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom component, that contains a list of another components. If I
I have written a new custom component derived from TLabel. The component adds some
I have a component where i want to display a custom jtooltip. That is
I have a custom component called shopView which is an MXML skinnable component. I
I have a custom WPF user control called a TimeoutPanel that I am trying
I have a custom JComponent that paints some stuff when paint is called. In
I have a custom Swing component called NavigationLink which extends JLabel and implements a
I have a custom component where I have implemented INotifyPropertyChanged and IBindableComponent . However,
I have a custom component which consists of 2 text view and 4 toggle
I have built a custom component using some containers and a TileList. Now when

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.