When a Flex app starts up, the StyleManager already has a set of selectors, such as for ApplicationControlBar and ComboBox. They have default settings for all the styles that the components expect to be set. If a style is unset, you can get RTEs or other misbehavior.

 

In general, you should be fetching these pre-existing selectors with StyleManager.getStyleDeclaration()  and modifying them with setStyle(). If instead you create a brand new CSSStyleDeclaration, you would have to set all the expected styles, and I'm not sure we do a good job of documenting what those are.

 

So to solve your second problem, try changing

 

   var comboBoxDeclaration:CSSStyleDeclaration = new CSSStyleDeclaration();

 

to

 

   var comboBoxDeclaration:CSSStyleDeclaration = StyleManager.getStyleDeclaration("ComboBox");

 

The first problem is probably similar, but I can't be sure because you don't show where applicationControlBarDeclaration came from.

 

- Gordon

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of phildouglas
Sent: Monday, August 21, 2006 7:33 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] StyleManager

 

Hey all. I'm having problems with setting styles progrmatically.

When I do the following:

applicationControlBarDeclaration.setStyle("fillAlphas", [1,1]);
applicationControlBarDeclaration.setStyle("fillColors",
[0xFF0000,0xFF0000]);
StyleManager.setStyleDeclaration('ApplicationControlBar',applicationControlBarDeclaration,true)

the ApplicationControlBar at the top of my app is invisible. even if
I only set the alphas to 1,1 it still hides the ApplicationControlBar
as if I'm setting the alphas to 0,0.

Also if i use the following to style a ComboBox:

var comboBoxDeclaration:CSSStyleDeclaration = new CSSStyleDeclaration()
comboBoxDeclaration.setStyle("selectionColor", gradientColour0);
comboBoxDeclaration.setStyle("rollOverColor", gradientColour0);
StyleManager.setStyleDeclaration('ComboBox',comboBoxDeclaration,true)

Then I get loads of debug errors, and my app crashes. Does anybody
have any ideas what might be causing these problems. (although the
ApplicationControlBar one is more of a priority).

Thanks.

Phil

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to