Adding styles to custom as3 components

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Adding styles to custom as3 components

    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!



    ddgasdgr Guest

  2. Similar Questions and Discussions

    1. Adding custom lines to paragraph styles?
      In the book style I'm using in ID CS, each section head is followed by a 5-pt. black 50% gradient line apx. 36p wider than the header text. I've been...
    2. Adding css class styles to images
      I have a page template created with css that I would like to allow my users to add images, and based on the style selected, have the image appear to...
    3. Components, XML and Styles
      hi, I'm loading a XML file using the XML connector and some components, ( Combo Box, TextArea, etc... ), the problem is I've plenty of text in one...
    4. Using styles to change components look in MX2004
      How can I change the color of the scrollpane border?? (or delete it) Thanks in advance
    5. Adding pop up menu styles
      Well, I have had Fireworks since v3, have never been able to create a custom popup style (image, not html). I create the style, save it as a style,...
  3. #2

    Default Re: Adding styles to custom as3 components

    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:




    protected override function childrenCreated():void {
    super.childrenCreated();
    this.setStyle("backgroundImage", image variable or path string);
    }

    Bryan Dresselhaus Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139