Ah. I read "I have a colorpicker object and I want to set the selected color programmatically depending on which textinput field a user is in"
as "If the user is in TextInput foo, then I want the color to be gray; if in bar, then blue, if in baz, then red." or something like that. If the question really is about parsing user input, StyleManager.getColorName() is handy, since it will also give you the correct answer for values like "red" or "blue" that are a little tricky to parse directly into ints unless you're dealing with base-26 or something and are willing to be very liberal in your definition of 'red'. -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com -----Original Message----- From: Josh McDonald <[EMAIL PROTECTED]> Reply-To: [email protected] To: [email protected] Subject: Re: [flexcoders] Is It Just Me? Date: Tue, 12 Aug 2008 10:38:38 +1000 Well the first case wouldn't help mapping from a text-field, and the post was more about "I can't figure our how to parse a number" than "how should I work with colours?" StyleManager.getColorName is an awful, *awful* name for that API if it converts from hex colours to uints :) But I'd still just use parseInt. Wait, doesn't the colour picker *have* a textbox you can copy/paste a hex code to and from? -Josh On Tue, Aug 12, 2008 at 10:33 AM, Maciek Sakrejda <[EMAIL PROTECTED]> wrote: Well, in this particular case, you could do // just use uint directly fontColor.selectedColor = 0xd3d3d3; // or use StyleManager fontColor.selectedColor = StyleManager.getColorName("#D3D3D3"); Admittedly, getColorName() is rather poorly named, and StyleManager is not the most obvious place to look (and the looks-like-it-should-be-the-right-thing ColorUtil class is not very helpful). Every framework has some unfortunate design decisions; Flex is really quite good once you get the hang of it. -- Maciek Sakrejda Truviso, Inc. http://www.truviso.com -----Original Message----- From: Dale Cook <[EMAIL PROTECTED]> Reply-To: [email protected] To: [email protected] Subject: [flexcoders] Is It Just Me? Date: Mon, 11 Aug 2008 23:59:55 -0000 OK, so I'm new to Flex but I have a lot of experience with other development platforms and languages(.NET, RoR, Javascript, etc.). I've read a few books and I've just been doing some fairly simple stuff to get my feet wet but already I'm starting to get a little fustrated with things that should be really easy. Perhaps I'm just missing something. For example, I have a colorpicker object and I want to set the selected color programmatically depending on which textinput field a user is in. So I suspected that I could do something like //the name of the color picker is fontColor fontColor.selectedColor = "#D3D3D3" and everything would be good - but that doesn't appear to be the case. It looks like I have to convert the hex into a uint. OK, that seems like a lot more work than it should be but OK, I'll just use the DecimalToHex function of the int class... oh, wait there isn't one. There isn't a conversion anywhere that I can find to do this without writting even more code. Is it just be or does this seem like a lot of work to do something that most other modern languages handle without any additional coding, or an I completely missing something? Dale ------------------------------------ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders% 40yahoogroups.comYahoo! Groups Links -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]

