actionscript 3 - Flex: How do you apply a style (from an external CSS) within the init/constructor of a custom as3 component? -


i had custom mxml component, have converted pure as3 component extends canvas. took stylings i.e. alpha, color etc. mxml , added them .css file under /src/assets/.

my question is, how apply these styles within custom as3 component i.e. constructor or init()?

i read declare style source in mainapp.mxml using <mx:style source="assets/css/swimlanestyle.css"/>. if so, how apply it?

the .css example below

/* css file */  canvas.roundedcanvasyellow{      backgroundcolor:#ffffcc;      cornerradius:5;      dropshadowenabled:true;     dropshadowcolor:#2a2929;     borderstyle:solid;     borderthickness:0;      backgroundalpha:0.9;     } 

should straight forward doing:

this.stylename = "roundedcanvasyellow" 

(i've used this. in example make clear, wouldn't include in real code).

or when create in instance of component programmatically instance.stylename = "roundedcanvasyellow", or if create instance in mxml set stylename attribute normal.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -