1 Reply Latest reply on Aug 6, 2008 9:16 PM by Gregory Lafrance

    Setting Color of ColorPicker

    craigkaminsky Level 3
      Hi,

      I feel like I am missing something obvious (checked the LIveDocs and Googled a ton). I have a Flex-based event management site. When adding a new event, the event owner has the option to select their link (and link hover) colors from a standard Flex ColorPicker. This works without any issues. However, when an event owner is editing an existing event's details, I need to set the color picker to show the previously selected colors, which are pulled from a database.

      Colors are stored in the database as strings in the following format: 0xFFFFFF, 0x537189, etc. If the colors are web-safe, I have no problem setting the selected color of the ColorPicker: myCP.selectedColor = uint('0xFFFFFF').

      If the color is not web-safe, my code falls over in that the correct color is not set (all non-web safe colors are set to 0xFFFF00 even though they are in the DB with the proper hex value).

      If I manually type in the hexadecimal color value to the ColorPicker's text field, the color is properly displayed and sent to the DB correctly when the form is submitted. If I reload the application, I then see the incorrect color I mentioned above.

      Stumped on this one. I've thought about loading a massive Array of hex values and set it as the DP of the ColorPicker but that seems like more work than should be necessary. Of course, I could force the client(s) to use web safe colors but then they'll just whine about how limiting 216 colors are for links :).

      If anyone has some thoughts on this or a solution, I would really appreciate it.

      Thanks,
      Craig