小小菜鸟的web菜园子

web开发学习。好记性不如烂笔头。每天进步一点点!

导航

设置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/

posted on 2008-05-19 13:23  『小小菜鸟』  阅读(339)  评论(0编辑  收藏  举报