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 (PDT)
To: <flexcoders@yahoogroups.com>
Subject: Re: [flexcoders] NaN and Infinity showing in output - How to
modify?

 
 

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 for NaN with something like this:

<mx:Label text="{(myNumber is NaN) ? 0 : PrepForDispl ay.format( myNumber)
}"/>

I'm not sure about infinity, but I assume that you can test for this by
looking for the greatest possible value of the number. Assuming that you
have set up the variable maxValue to contain that value, you should be able
to do something like this:

<mx:Label text="{(myNumber > maxValue) ? 0 : PrepForDispl ay.format(
myNumber) }"/>

If you put the two together, it would look something like this:

<mx:Label text="{(myNumber is NaN) ? 0 : (myNumber > maxValue) ? 0 :
PrepForDispl ay.format( myNumber) }"/>

 
Sid Maskit
Partner 
CraftySpace
Better Websites for a Better World
http://www.CraftySpace.com
blog: http://smaskit.blogspot.com/


----- Original Message ----
From: cox.blair <[EMAIL PROTECTED]>
To: flexcoders@yahoogroups.com
Sent: Thursday, July 31, 2008 6:41:18 AM
Subject: [flexcoders] NaN and Infinity showing in output - How to modify?

 
 

I seem to have trouble explaining myself here, hard when you are just
learning. Perhaps this will be better.

Is it possible to remove, change or hide any label or text output that
displays NaN or Infinity?

I'm performing a very simply calculation where the user enters a
number in a form and it is calculated and displayed. Simple and does
what I need. In some instances, there are more variables required and
until they are provided, the output display NaN or Infinity.

How could I easily adjust these? It could be a default display of
zero, it could be to display nothing, whatever is the easiest and most
straight forward method.

Below is only an example of how I'm taking the user input from the
form and passing the variable on to the Label text output.

<mx:Number id="myNumber" >{Number( userInput. text) * (1 +
Number(otherUserInp ut.text)) * 10000 /
Number(otherOtherUs erInput.text) }</mx:Number>

The answer is output to:

<mx:Label text="{PrepForDispl ay.format( myNumber) }"/>

Thank you, any assistance you can provide would be welcomed.

 
  

 
 
    

Reply via email to