设置NumericStepper控件的文字对其方式。

NumericStepper 控件的 textAlign 样式学习.

示例:(右键查看源文件)

代码:
<? xml version="1.0" encoding="utf-8" ?>
<!--  http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/  -->
< mx:Application  xmlns:mx ="http://www.adobe.com/2006/mxml"
        layout
="vertical"
        verticalAlign
="middle"
        backgroundColor
="white" >

    
< mx:Array  id ="arr" >
        
< mx:Object  label ="left"   />
        
< mx:Object  label ="center"   />
        
< mx:Object  label ="right"   />
    
</ mx:Array >

    
< mx:ApplicationControlBar  dock ="true" >
        
< mx:Form  styleName ="plain" >
            
< mx:FormItem  label ="textAlign:" >
                
< mx:ComboBox  id ="comboBox"
                        dataProvider
=" {arr} "   />
            
</ mx:FormItem >
        
</ mx:Form >
    
</ mx:ApplicationControlBar >

    
< mx:NumericStepper  id ="numericStepper"
            textAlign
=" {comboBox.selectedItem.label} "
            width
="100"   />

</ mx:Application >

你也可以通过以下2种方式设置样式:
< mx:Style >
    NumericStepper {
        textAlign: right;
    }
</ mx:Style >

< mx:Script >
    
<![CDATA[
        private function init():void {
            numericStepper.setStyle("textAlign", "right");
        }
    
]]>
</ mx:Script >


来自: http://blog.flexexamples.com/2008/05/18/setting-the-text-alignment-in-a-numericstepper-control-in-flex/

你可能感兴趣的:(设置)