|  | Changing color of area with AS/ComboBox? |  | |
| | | Urban L |  |
| Posted: Tue Sep 02, 2008 4:45 pm Post subject: Changing color of area with AS/ComboBox? |  |
I want to change the colors in the geographic areas in a map based on which selection was chosen from a comboBox where the hex color codes to be used are stored someplace (xml file?). For example, if user chooses "1980" in the combo box, Minnesota will be blue, but if user chooses "2004", Minnesota will be red. Any suggestion of an example of or tutorial on how to do this? At this point, I don't care if it's with AS2 or AS3.
I assume each geographic area would be an object whose color is set after each selection. But rather than start from scratch, I'd love to see an example that's close to what I want. |
| |
| | | DMennenoh **AdobeCommunit |  |
| Posted: Tue Sep 02, 2008 4:45 pm Post subject: Re: Changing color of area with AS/ComboBox? |  |
You can use the comboBox's dataProvider array. If, for example, you have a comboBox on stage with an instance name of "years" you might do:
var myListener = new Object(); myListener.change = function(eventOb:Object){ var selData = years.selectedItem; trace(selData.color); } years.addEventListener("change", myListener);
var myData = [{label:"2005", color:0xFF0000, stateIndex:2}, {label:"2008", color:0x0000FF, stateIndex:16}];
years.dataProvider = myData;
Now, whenever you pick a new item in the dropdown the color will be traced...
HTH
-- Dave - LINK Head Developer LINK Adobe Community Expert LINK |
| |
|
|