[flexcoders] Formatting Dates/Times

2008-08-25 Thread Dale Cook
Is there a way to format a date/time.
For example if I use some thing like

var newDate:Date = new Date();
dateLabel.text = newDate.toDateString();

what I get is something like 'Mon Aug 25 2008' and what I want is
something like 'Monday, August 25th, 2008'. I would have thought this
would be straightforward but I can't seem to find a way for formatting
these dates.

Dale



[flexcoders] User resizable TextArea

2008-08-22 Thread Dale Cook
Apart from using the ObjectHandles library to achieve this, does
anyone know of a TextArea replacement that can be resized by the user?

Dale



[flexcoders] How to determine object type

2008-08-21 Thread Dale Cook
Is there a simple way to use reflection to determine the type of an
object. I would have thought that that Object would have a method
called class (or something similar) that would return a string
representation of the type of the class but that doesn't seem to be
the case.

Dale



[flexcoders] TextInput and TextArea ancestory

2008-08-21 Thread Dale Cook
I need to write a class that can contain either a TextArea or
TextInput as one of it's private parameters. Essentially it's a
composite component that can be either a TextInput or TextArea with
some additional properties. My problem arises from the fact that the
common ancestor to both of these controls is UIComponent that does not
have a text attribute so I can't cast down to that common ancestor
when setting the text attribute.
Since I don't know that much about Flex I was wondering if there's a
common interface I'm missing or some other way to achieve access to
what I thought would be a common attribute.

Dale 



[flexcoders] Setting combobox selected item manually

2008-08-12 Thread Dale Cook
I have a number of TextInput components on a form, and each input can
have a different font, which is chosen from a combo box. The combo box
definition looks something like this

mx:ComboBox id=fontType dataProvider={fonts} change=changeFont()
/mx:ComboBox

the fonts data source is defined like this

[Bindable]
private var fonts:ArrayCollection = new ArrayCollection(
[ 
{label:Arial, data:Arial},
{label:Blue Highway, data:BlueHighway}, 
{label:High Strung, data:HighStrung}
]);

Pretty straight forward. My issue arises when I move from TextInput to
TextInput. I want the ComboBox to reflect the font of the TextInput
with the focus. The problem is that I can't work out a better way to
do that than this:

for(var index:int = 0; index  fonts.length; index++)
{   
if(fonts[index].data == currentFocus.fontFamily)
{
fontType.selectedItem = fonts[index];
}
}

where currentFocus is the TextInput and fontFamily is a function that
returns the current font of that control (actually the TextInput
controls are housed in custom components that supply the fontFamily
function but that isn't important here).

Is there an easier way to do this?

Dale





[flexcoders] Re: Is It Just Me?

2008-08-12 Thread Dale Cook
Actually, just to be clear, I'm certainly not saying the Flex sucks -
far from it, 
I'm actually saying that I'm just surprised that some things that
should be really easy don't seem, to me anyway, to make logical sense.
However, that being said some things that should be really hard are
surprisingly easy.

So I suspect that it's me who just isn't getting it. Perhaps I'm just
looking for answers in the wrong places.

Dale 

--- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote:

 Nothing says please help me out like your tech sucks you jerks.
 
 fontColor.selectedColor = parseInt(textbox.text.replace(#,),16);
 
 -Josh
 
 On Tue, Aug 12, 2008 at 9:59 AM, Dale Cook [EMAIL PROTECTED] wrote:
 
  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]





[flexcoders] Re: Is It Just Me?

2008-08-12 Thread Dale Cook
Right, it does have a text box, with the color in Hex notation, so
you'd assume that there'd be a real easy way, in ActionScript, to pass
a hex value to it, but there isn't.
I find this perplexing.


--- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote:

 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: flexcoders@yahoogroups.com
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Is It Just Me?
  Date: Mon, 11 Aug 2008 23:59:55 -
 
  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]





[flexcoders] Is It Just Me?

2008-08-11 Thread Dale Cook
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