When you set selectedItem, Flex controls try to find an exact match of that
item. If the dataProvider contains objects, you must have same object
reference, not a copy.
In this case, the array probably contains numbers, so assigning the number
as selectedItem should work.
I can't seem to get it to work
The array is the program looks like this:
super.dataProvider = new ArrayList([0x000000, 0xFF0000, 0xFF8000, 0xFFFF00, 0x80FF00, 0x00FF00, 0x00FFFFF, 0x0080FF, 0x0000FF, 0x8000FF, 0xFF00FF, 0xFFFFFF]);
I dont know how to refer to it from the main program
Well, you could store the arraylist in a member variable if you want.
But how do you know which selectedItem you want to start with? Is it
coming from some user action or data?
no, i just want to set it myself in creationcomplete
specifically i would like white as the starting color instead of black
I would think you would just set selectedItem=0xFFFFFF;
Did that not work?
Nope, i tried that and it still comes up as black
This is interesting, i'm using it to define the color of my pen tool and my pen tool comes out white but the colorpicker icon is black
Where does it say that the icon color will be black in your colorpicker?
This worked for me:
<local:SparkColorPicker id="scp" y="30" skinClass="ColorPickerListSkin"
change="colorChanged()" selectedItem="0xFFFFFF" /
Do you know how to change the colorpickers's icon color from with <fx:script>?
Ive tried doing bgcp.selectedItem = "0xFFFFFF"
That makes the color of the object that it's coloring change, but the icon color does not change
How does that code get called? From an event?
Yeah, it's on a button click
1 person found this helpful
I see. That is a bug. Where we listen for Event.CHANGE in
SparkColorPicker.as, we should also listen for FlexEvent.VALUE_COMMIT.
Brilliant, that worked