Thursday, June 7, 2012

Rounding a Decimal number to a given precision in Action sript

I found the below blog very useful for this problem
Truncating and Rounding Numbers in ActionScript 3

will also write something about it later

Setting all the dates before today as unsetectable in Date Field

If you want to have a date field where user is allowed to only select either today or any date after today you will have to use the disabledRanges property of Date filed like being used in the example below

<mx:DateField id="startDateForRAC" yearNavigationEnabled="true"
                    change="dateChanged(DateField("  width="91"
                     disabledRanges="{[ {rangeEnd: new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate()-1)} ]}"
                    selectedDate="{new Date(today.getFullYear(), today.getMonth(), today.getDate())}" />

Note that only rangeEnd will be used to have a similar date field.