Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-08-01 Thread Tom Chiverton
On Thursday 31 Jul 2008, Sid Maskit wrote: mx:Label id=display text={(isNaN(myNumber as Number)) ? 0 : PrepForDisplay.format(myNumber)} Eww. That is so hard to read. Either use a labelFunction or just fix PrepForDisplay.format(). -- Tom Chiverton

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-08-01 Thread Sid Maskit
Eww, eh? Well, gee, Tom, I hope I didn't spoil your breakfast or anything ;) I think both your refactorings are good ones. I was definitely in how do we get this working mode, not how do we get this as elegantly written as possible mode: i.e. I was in code-writing not refactoring mode. So I

RE: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-08-01 Thread Gordon Smith
I don't recommend writing complicated binding expressions, because you have to use lt; in place of , gt; in place of , and amp; in place of . Gordon Smith Adobe Flex SDK Team From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sid

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-07-31 Thread Sid Maskit
If the format function is a custom function you have written, you could just have it check whether you like the result it is about to return, and if not, return something else. If that is not the case, I believe that you should be able to put tests into your binding statement. You could test

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-07-31 Thread Blair Cox
Hi Sid, thanks for the reply. I tried your first solution since I did not create a custom function and it returns; 1067: Implicit coercion of value of type Number to an unrelated type Class I have a vague understanding of what is occurring here. Any way around it? How difficult would it be to

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-07-31 Thread Blair Cox
Hi Sid, thanks a lot for your help. I figured it out! Really just need a starting point for where to look. Cheers! isNaN(mynumber) ? 0 : -- Blair Cox http://www.luminultra.com From: Sid Maskit [EMAIL PROTECTED] Reply-To: flexcoders@yahoogroups.com Date: Thu, 31 Jul 2008 07:51:38 -0700

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-07-31 Thread Blair Cox
Just one more question. The zero works for me, but I¹m sure I¹ll be asked to make it blank. Any hints as to how this could be accomplished? Coming from the Flash side of things, all I would be looking to do is change the alpha value of the label to zero if the value was 0. isNaN(mynumber) ? 0 :

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-07-31 Thread Laurent Cozic
How about: sNaN(mynumber) ? 0 : -- Laurent Cozic Flash, Flex and Web Application development http://pogopixels.com - Original Message From: Blair Cox [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Thursday, July 31, 2008 5:19:46 PM Subject: Re: [flexcoders] NaN and

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-07-31 Thread Sid Maskit
Try something like this: mx:Label id=display text={(isNaN(myNumber as Number)) ? 0 : PrepForDisplay.format(myNumber)} visible={display.text != '0' amp;amp; display.text != 'In,fin,ity.00'}/ Note that you need to give the Label component and id, and use that id to refer to it in your

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-07-31 Thread Sid Maskit
Actually, if you are just going to hide the label field, you can just have it display the result of the formatting, and put the checking for NaN and infinity into the setting for visibility. Since you are going to hide the label and it has a value you don't like, you don't really care what it

Re: [flexcoders] NaN and Infinity showing in output - How to modify?

2008-07-31 Thread Blair Cox
Hmm, sorry the last post left a part out, it was shown lower down: mx:Label ... text={isNaN(mynumber) ? 0 : PrepForDisplay.format(mynumber)} ... / Adding the ³² as you stated, returns an error for mx:Label, ³² or ³/². The zero is what is display in the application, if I could provide a short