[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 895
  • Last Modified:

Flex 4.6 Formatting a Binded Label with Decimal Places

In the following example I have a spark label that is binded to the average value of 4 other Numeric Steppers.  This work fine apart from (depending on the values) i'm getting results with too many decimal place's.

<s:Label text="{(numericStepper1.value + numericStepper2.value + numericStepper3.value + numericStepper4.value)/4}"/>

Open in new window



For example i'm getting:
43.84999999999999

Instead I want:
43.85
0
RenAndStimpy
Asked:
RenAndStimpy
1 Solution
 
RenAndStimpyAuthor Commented:
Yep, toFixed(2) did the trick.

s:Label text="{((numericStepper1.value + numericStepper2.value + numericStepper3.value + numericStepper4.value)/4).toFixed(2)}"/>

Open in new window

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now