The following example shows how you can debug a component’s inheriting styles by using the static ObjectUtil.toString() method to display a component’s inheritingStyles property.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/12/24/displaying-a-combobox-controls-inherited-styles-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white"
        creationComplete="init();">

    <mx:Script>
        <![CDATA[
            import mx.utils.ObjectUtil;

            private function init():void {
                textArea.text = ObjectUtil.toString(comboBox.inheritingStyles);
            }
        ]]>
    </mx:Script>

    <mx:Array id="arr">
        <mx:Object label="One" />
        <mx:Object label="Two" />
        <mx:Object label="Three" />
        <mx:Object label="Four" />
        <mx:Object label="Five" />
        <mx:Object label="Six" />
        <mx:Object label="Seven" />
    </mx:Array>

    <mx:ComboBox id="comboBox" dataProvider="{arr}" />

    <mx:Form width="100%" height="100%">
        <mx:FormItem label="inheritingStyles:"
                width="100%"
                height="100%">
            <mx:TextArea id="textArea"
                editable="false"
                width="100%"
                height="100%" />
        </mx:FormItem>
    </mx:Form>

</mx:Application>

View source is enabled in the following example.

 
Tagged with:
 
About The Author

Peter deHaan

Peter deHaan currently works for Adobe on the Flex SDK QA team. While not working on Flex, Flash, and ColdFusion applications, Peter enjoys making up bios and writing in 3rd person. Peter's rarely updated blog can be found at blogs.adobe.com/pdehaan/, actionscriptexamples.com, airexamples.com, and coldfusionexamples.com.

Comments are closed.