1 Reply Latest reply on Sep 7, 2010 12:33 PM by ShardulSingh

    Get Style Name

    Arun Ganesh Level 3

      Hi Everyone,


      Is it possible to get the style name of the component through script?



      Thanks in Advance

        • 1. Re: Get Style Name
          ShardulSingh Level 3


          Yes you can do it.Try like this:-




          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
                      import mx.controls.Alert;          
                      private function getYourComponentStyle():void
                       Alert.show(btn.getStyle('paddingLeft')+ "........padding-left.")  
                       Alert.show(btn.getStyle('paddingRight')+ "........padding-Right.")
                       Alert.show(btn.getStyle('fontSize')+ "........fontSize.");
                       Alert.show(btn.getStyle('color')+ "........color.");   
                      padding-left : 12;
                      padding-right : 2;
                      fontSize: 12pt;
                      color: Green;
              <mx:Button id="btn" label="Dummy Button" styleName="buttonStyle0"/>
              <mx:Button label="Get Style of Dummy Button" click="getYourComponentStyle()"/>








          with Regards,


          Shardul Singh Bartwal