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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:28:02+00:00 2026-05-21T09:28:02+00:00

I have a Spark ButtonBar that has a custom skin, which defines a custom

  • 0

I have a Spark ButtonBar that has a custom skin, which defines a custom skin for the “middleButton” requirement. My CustomButtonBarSkin has a custom state, minimized, which I want to pass into my middleButton skin so it can modify its design.

Is it possible to do this? I can see that my button skin could use parentDocument.currentState to get the minimized state, but that’s really ugly. Any way to pass a skin from the bar to the child button(s)?

  • 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-21T09:28:03+00:00Added an answer on May 21, 2026 at 9:28 am

    I think you should extend default ButtonBar. Something like this:

    package
    {
    import mx.core.IFactory;
    
    import spark.components.ButtonBar;
    
    [SkinState("minimized")]
    [SkinState("minimizedDisabled")]
    public class MinimizableButtonBar extends ButtonBar
    {
        public function MinimizableButtonBar()
        {
            super();
    
            itemRendererFunction = defaultButtonBarItemRendererFunction;
        }
    
        [SkinPart(required="true", type="mx.core.IVisualElement")]
        public var middleButtonMinimized:IFactory;
    
        private var _minimized:Boolean;
    
        [Bindable]
        public function get minimized():Boolean
        {
            return _minimized;
        }
    
        public function set minimized(value:Boolean):void
        {
            if (_minimized == value)
                return;
    
            _minimized = value;
            invalidateSkinState();
            itemRendererFunction = defaultButtonBarItemRendererFunction;
        }
    
        override protected function getCurrentSkinState():String
        {
            if (_minimized)
                return enabled ? "minimized" : "minimizedDisabled";
            return super.getCurrentSkinState();
        }
    
        private function defaultButtonBarItemRendererFunction(data:Object):IFactory
        {
            var i:int = dataProvider.getItemIndex(data);
            if (i == 0)
                return firstButton ? firstButton : (_minimized ? middleButtonMinimized : middleButton);
    
            var n:int = dataProvider.length - 1;
            if (i == n)
                return lastButton ? lastButton : (_minimized ? middleButtonMinimized : middleButton);
    
            return (_minimized ? middleButtonMinimized : middleButton);
        }
    }
    }
    

    So using this code you can declare your custom skin with the following way:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Skin alpha.disabledGroup="0.5" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
        <fx:Metadata>[HostComponent("MinimizableButtonBar")]</fx:Metadata>
    
        <s:states>
            <s:State name="normal" />
            <s:State name="disabled" stateGroups="disabledGroup" />
            <s:State name="minimized" stateGroups="minimizedGroup" />
            <s:State name="minimizedDisabled" stateGroups="disabledGroup,minimizedGroup" />
        </s:states>
    
        <fx:Declarations>
            <fx:Component id="firstButton">
                <s:ButtonBarButton skinClass="spark.skins.spark.ButtonBarFirstButtonSkin" />
            </fx:Component>
            <fx:Component id="middleButton">
                <s:ButtonBarButton skinClass="spark.skins.spark.ButtonBarMiddleButtonSkin" />
            </fx:Component>
            <fx:Component id="middleButtonMinimized">
                <s:ButtonBarButton skinClass="MinimazedButtonBarMiddleButtonSkin" />
            </fx:Component>
            <fx:Component id="lastButton">
                <s:ButtonBarButton skinClass="spark.skins.spark.ButtonBarLastButtonSkin" />
            </fx:Component>
        </fx:Declarations>
    
        <s:DataGroup height="100%" id="dataGroup" width="100%">
            <s:layout>
                <s:ButtonBarHorizontalLayout gap="-1" />
            </s:layout>
            <s:layout.minimizedGroup>
                <s:VerticalLayout />
            </s:layout.minimizedGroup>
        </s:DataGroup>
    </s:Skin>
    

    Hope this solves your problem.

    And if your minimized state is only about changing middle button skin you can remove all states related code both from custom component and from skin.

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

Sidebar

Related Questions

I have an ArrayCollection that is the dataProvider for a spark.components.List , which has
in my project I have a Panel which is using a custom skin that
I've created a skin that allows me to have two labels on a spark
I have created a custom skin for DropDownList (i.e modified the default spark.skins.spark.DropDownListSkin )
I have a custom skin applied to a Flex 4 spark datagrid. One really
I have created a spark ButtonBar which is dynamically populated with XML and skinned
I use Spark View Engine with nested master pages. I have Application.spark which defines
I have a project where we are trying to skin Spark components from a
Say I have the following custom component: <s:Group xmlns:fx=http://ns.adobe.com/mxml/2009 xmlns:s=library://ns.adobe.com/flex/spark xmlns:mx=library://ns.adobe.com/flex/mx> <fx:Script> <![CDATA[ [Bindable]
I have a spark TabBar and I want to hide and show some elements

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.