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

          Hi,

          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">
              <mx:Script>
                  <![CDATA[
                      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.");   
                          }
                  ]]>
            
              </mx:Script>
              <mx:Style>
                  .buttonStyle0
                  {
                      padding-left : 12;
                      padding-right : 2;
                      fontSize: 12pt;
                      color: Green;
                  }
              </mx:Style>
              <mx:Button id="btn" label="Dummy Button" styleName="buttonStyle0"/>
              <mx:Button label="Get Style of Dummy Button" click="getYourComponentStyle()"/>
          </mx:Application>

           

           

           

           

           

           

           

          with Regards,

           

          Shardul Singh Bartwal