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
string instead, it would be ideal. Even if the initial default text of the
label was ³whatever² until a calculated value was entered. But there are
many, many of these calculations to perform and I would like to find the
simplest answer. Close though, thanks for the help.

-- 
Blair 




From: Laurent Cozic <[EMAIL PROTECTED]>
Reply-To: <[email protected]>
Date: Thu, 31 Jul 2008 09:28:51 -0700 (PDT)
To: <[email protected]>
Subject: Re: [flexcoders] NaN and Infinity showing in output - How to
modify?

 
 

How about:

sNaN(mynumber) ? 0 : ""
 
--
Laurent Cozic

Flash, Flex and Web Application development
http://pogopixels.com


----- Original Message ----
From: Blair Cox <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, July 31, 2008 5:19:46 PM
Subject: Re: [flexcoders] NaN and Infinity showing in output - How to
modify?

 
 

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 :


-- 
Blair Cox

http://www.luminult ra.com <http://www.luminultra.com>
 





From: Sid Maskit <[EMAIL PROTECTED] com>
Reply-To: <[EMAIL PROTECTED] ups.com <http://ups.com> >
Date: Thu, 31 Jul 2008 07:51:38 -0700 (PDT)
To: <[EMAIL PROTECTED] ups.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.CraftySp ace.com <http://www.CraftySpace.com>
blog: http://smaskit. blogspot. com/ <http://smaskit.blogspot.com/>
 
 

Reply via email to