Select to view content in your preferred language

Accessing main config.xml from a widget

1608
3
Jump to solution
07-18-2014 12:11 PM
BrianFrizzelle
Emerging Contributor

I'm working on a widget for the Viewer for Flex. There are some elements that I disable based on certain conditions, such as the layer that is loaded or a variable that is selected. For example, I have a CheckBox that when clicked will convert a variable to a density (e.g., pop per square mile), and I disable it (enabled = false) when a rate variable is displayed.


When I disable the CheckBox, I also convert the Spark Label next to it to italics and change the color to a medium gray to indicate that it is inactive.

My problem arises when I want to return the Label text to the normal style and the default color (see line 17 below). In the development environment, the widget is gray and the text is white. I have hard-coded this color change, but when I move this widget over to another application that uses a different color scheme with black text, then the Label suddenly stands out wrong because I'm coloring it white.

What I really want to do is to read the text color that is specified in the main config.xml file for the viewer application and assign that color in line 17.

How do I read that from inside a widget?

protected function classificationFieldsDDL_changeHandler(event:IndexChangeEvent):void

            {

                classificationField = DropDownList(event.currentTarget).selectedItem.data;

                classificationFieldAlias = DropDownList(event.currentTarget).selectedItem.label;

                classificationFieldNormalize = DropDownList(event.currentTarget).selectedItem.norm;

                if (classificationFieldNormalize == '0')

                {

                    normalizationChkBx.selected = false;

                    normalizationChkBx.enabled = false;

                    normalizationLabel.setStyle('fontStyle', 'italic');

                    normalizationLabel.setStyle('color', '0xa0a0a0');

                }

                else

                {

                    normalizationChkBx.enabled = true;

                    normalizationLabel.setStyle('fontStyle', 'normal');

                    normalizationLabel.setStyle('color', '0xffffff');

                }

                generateRenderer();

            }

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Brain,

  For that you just us:

normalizationLabel.setStyle('color', getStyle('accentColor'));

btw. There is a specific forum for ArcGIS Viewer discussions: ArcGIS Viewer for Flex

Robert

View solution in original post

0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Brain,

  For that you just us:

normalizationLabel.setStyle('color', getStyle('accentColor'));

btw. There is a specific forum for ArcGIS Viewer discussions: ArcGIS Viewer for Flex

Robert

0 Kudos
BrianFrizzelle
Emerging Contributor

Thanks. And sorry about the wrong forum.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brain,

   Not a problem. Can I have you fix the fact that you marked your original post as the assumed answer, and click on the "Correct Answer" link on my reply instead?

0 Kudos