# Dynamic color change problem! Please help

**URL:** <https://forum.kirupa.com/t/dynamic-color-change-problem-please-help/236261>\
**Category:** Uncategorized\
**Created:** [August 19, 2007, 4:41am UTC](https://forum.kirupa.com/t/dynamic-color-change-problem-please-help/236261 "2007-08-19T04:41:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daJunkCollector](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@daJunkCollector](https://forum.kirupa.com/u/daJunkCollector)\
**Post date:** [August 19, 2007, 4:41am UTC](https://forum.kirupa.com/t/dynamic-color-change-problem-please-help/236261/1 "2007-08-19T04:41:23Z")

</div>

Hey Guys, Code is provided below. I have an example or what works and what doesn’t. I am about to throw my computer out the window.

This code works:

[COLOR=#222222]function paCountyHighlight(targetCounty) {[/COLOR]  
[COLOR=#222222]var myColor:Color = new Color(this.usa.pa\_counties.Washington);[/COLOR]  
[COLOR=#222222]myColor.setRGB(\_root.hoverColor);[/COLOR]  
[COLOR=#222222]\_root.countyLabel = targetCounty+", PA"\_root.displayCountyLabel();[/COLOR]

When I change it to support my needs it does not work! I have tried hours on end to get this going:

[COLOR=#222222]function paCountyHighlight(targetCounty) {[/COLOR]  
[COLOR=#222222]var countyColored = this.usa.pa\_counties.targetCounty; [/COLOR]  
[COLOR=#222222]var myColor:Color = new Color(countyColored); [/COLOR]  
[COLOR=#222222]myColor.setRGB(\_root.hoverColor);[/COLOR]  
[COLOR=#222222]\_root.countyLabel = targetCounty+", PA";[/COLOR]  
[COLOR=#222222]\_root.displayCountyLabel(); [/COLOR]  
[COLOR=#222222]}[/COLOR]

You should be able to see what I am trying to do. I am trying to use the parameter rather than the hard-coded county name. I tried a million different ways to call this county to change color. I even tried the setTransform method. PLEASE shed some light on this for me. ☹
