[flexcoders] Re: Best practices for dynamically styling components in FlashBuilder 4.5
So as it turns out, the reason that I was getting errors on my custom styles was that I was trying to use a pre-existing stylename (fillColor was already taken). It seems to be working somewhat well now and I might have my solution; however, I'd really like to hear any suggestions anyone still may have! =]
[flexcoders] Re: Best practices for dynamically styling components in FlashBuilder 4.5
Note: As a potential solution, I have been trying to add some custom style properties to my various components (ie. fillColor, fillAlpha, etc.), then setting these properties via CSS. The thought was that I could then simply update those properties using the styleManager.getStyleDeclaration() method, and in my components, set the colors using getStyle(). The issue is that the compiler throws errors when I try to implement the custom styles in my stylesheet using a custom style. Example: .myStyle { fillColor: 0x00; fillAlpha: .5; } The previous code would throw an error that the compiler did not recognize the style properties for fillColor or fillAlpha. If I can figure out a way to get past this, then I might have a solution... Thanks again!! --- In flexcoders@yahoogroups.com, "c0mpl3xxx" wrote: > > Hi all, > I'm trying to create a set of components for a video player app that require > the ability to be styled via user supplied color options. Basically I have a > set of buttons and text objects that will receive custom color properties > from the user. This would be easy enough to accomplish using custom style > properties on the components and a little CSS; however, I can't figure out > how to make this work since the color data is dynamic and served up by the > server (i.e. I can't hard-code or create any css style sheets during the > build process). > > I am looking for any ideas / best practices on how to accomplish the > following: > > 1) Styling components using data supplied at run-time > 2) Updating specific stylesheet properties at run-time (i.e. I want to change > the fontSize value for a custom style called ".h1"). > > Ideally I'd be able to link the various components to some stored properties > (like css) and then just update those properties and have the components > automatically respond. Any suggestions would be greatly appreciated! > > Thanks! >
[flexcoders] Re: Best practices for dynamically styling components in FlashBuilder 4.5
Thanks TH, That will help with updating the font sizes! If anyone else has any other thoughts or suggestions on how to best manage updating the color styles of the buttons and other components, it would be greatly appreciated!
[flexcoders] Re: Best practices for dynamically styling components in FlashBuilder 4.5
styleManager.getStyleDeclaration(style_name).setStyle("property", value); -TH --- In flexcoders@yahoogroups.com, "c0mpl3xxx" wrote: > > Hi all, > I'm trying to create a set of components for a video player app that require > the ability to be styled via user supplied color options. Basically I have a > set of buttons and text objects that will receive custom color properties > from the user. This would be easy enough to accomplish using custom style > properties on the components and a little CSS; however, I can't figure out > how to make this work since the color data is dynamic and served up by the > server (i.e. I can't hard-code or create any css style sheets during the > build process). > > I am looking for any ideas / best practices on how to accomplish the > following: > > 1) Styling components using data supplied at run-time > 2) Updating specific stylesheet properties at run-time (i.e. I want to change > the fontSize value for a custom style called ".h1"). > > Ideally I'd be able to link the various components to some stored properties > (like css) and then just update those properties and have the components > automatically respond. Any suggestions would be greatly appreciated! > > Thanks! >