2012-04-05 66 views

回答

7

使用的NumericStepper的valueFormatFunction

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx"> 

    <fx:Script> 
     <![CDATA[ 
      protected function formatNumber(value:Number):String 
      { 
       if (value < 10) 
        return '0' + value; 

       return value.toString(); 
      } 
     ]]> 
    </fx:Script> 

    <s:NumericStepper valueFormatFunction="formatNumber" 
         minimum="0" 
         maximum="100" /> 

</s:Application> 
+0

謝謝出色答卷 – 2012-04-07 16:28:14