1 Reply Latest reply on May 20, 2008 9:50 AM by Bryan Dresselhaus

    Adding styles to custom as3 components

    ddgasdgr
      I understand how to add styles to custom components in Flex but can anyone shed light on the correct way to define a background image style in the class constructor? i.e what is the correct "type" for a backgroundImage:

      [Style(name="backgroundImage", type="????", inherit="no")]

      thanks in advance to anyone who can help!

        • 1. Adding styles to custom as3 components
          Bryan Dresselhaus
          If your custom component is a UIComponent, you can use the setStyle(styleProp:String, newValue:*):void method. You can override the protected method childrenCreated():void or commitProperties():void. If you have a lot of properties to style, you may want to use a css file and set the styleName property of the UIComponent to a preset style.

          In this case, if you have a background image, just do: