"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 suppose I
shouldn't complain about you pointing out a bad smell coming from the code
writing.
Having said that, I have to admit that I am not at all clear as to protocol for
how much ActionScript is acceptable within braces while assigning to an MXML
attribute, or whether there are accepted standards for this. I have the fear
that this might be a religious question, but maybe not. If there are accepted
protocols, I'd love to hear what they are.
Just to help clarify things, I'm wondering whether you have any objection to
ternary statements, or if you do just feel that this is too much code to have
within an attribute assignment. For example, would this satisfy your objection:
<mx:Script>
<![CDATA[
private function formatLabel():String {
private var result:String;
result = (isNaN(myNumber as Number)) ? 0 :
PrepForDisplay.format(myNumber);
return result;
}
]]>
</mx:Script>
<mx:Label id="display" text="{formatLabel()}" />
Sid Maskit
Partner
CraftySpace
Better Websites for a Better World
http://www.CraftySpace.com
blog: http://smaskit.blogspot.com/
----- Original Message ----
From: Tom Chiverton <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, August 1, 2008 5:04:56 AM
Subject: Re: [flexcoders] NaN and Infinity showing in output - How to modify?
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
****************************************************
This email is sent for and on behalf of Halliwells LLP.
Halliwells LLP is a limited liability partnership registered in England and
Wales under registered number OC307980 whose registered office address is at
Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list
of members is available for inspection at the registered office. Any reference
to a partner in relation to Halliwells LLP means a member of Halliwells LLP.
Regulated by The Solicitors Regulation Authority.
CONFIDENTIALITY
This email is intended only for the use of the addressee named above and may be
confidential or legally privileged. If you are not the addressee you must not
read it and must not use any information contained in nor copy it nor inform
any person other than Halliwells LLP or the addressee of its existence or
contents. If you have received this email in error please delete it and notify
Halliwells LLP IT Department on 0870 365 2500.
For more information about Halliwells LLP visit www.halliwells.com.
------------------------------------
--
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