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: flexcoders@yahoogroups.com
To: flexcoders@yahoogroups.com
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




 


Reply via email to