小小菜鸟的web菜园子

专注FLEX,AIR,FLASH

统计

留言簿(10)

积分与排名

AMF

FLASH

FLEX

FMS

Friends

开源框架

设计之美

数据库相关

我的作品

阅读排行榜

评论排行榜

设置NumericStepper控件的背景色和透明度。

NumericStepper控件的backgroundColorbackgroundAlpha 样式学习。
示例:

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

    
<mx:ApplicationControlBar dock="true">
        
<mx:Form styleName="plain">
            
<mx:FormItem label="backgroundAlpha:">
                
<mx:HSlider id="slider"
                        minimum
="0.0"
                        maximum
="1.0"
                        value
="1.0"
                        snapInterval
="0.1"
                        tickInterval
="0.1"
                        liveDragging
="true" />
            
</mx:FormItem>
            
<mx:FormItem label="backgroundColor:">
                
<mx:ColorPicker id="colorPicker"
                        selectedColor
="white" />
            
</mx:FormItem>
        
</mx:Form>
    
</mx:ApplicationControlBar>

    
<mx:NumericStepper id="numericStepper"
            backgroundAlpha
="{slider.value}"
            backgroundColor
="{colorPicker.selectedColor}" />

</mx:Application>

你也可以把样式写在CSS中.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/05/23/setting-the-background-color-and-background-alpha-for-a-numericstepper-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout
="vertical"
        verticalAlign
="middle"
        backgroundColor
="white">

    
<mx:Style>
        NumericStepper {
            backgroundAlpha: 0.5;
            backgroundColor: red;
        }
    
</mx:Style>

    
<mx:NumericStepper id="numericStepper" />

</mx:Application>

你也可以使用AS的setStyle()方法:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/05/23/setting-the-background-color-and-background-alpha-for-a-numericstepper-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout
="vertical"
        verticalAlign
="middle"
        backgroundColor
="white">

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

    
<mx:NumericStepper id="numericStepper"
            creationComplete
="init();" />

</mx:Application>
Tag标签: FLEX,NumericStepper

posted on 2008-05-24 13:36 『小小菜鸟』 阅读(58) 评论(0)  编辑 收藏 网摘 所属分类: FLEX


标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
"五向定位"职业成长路线公开课(上海、南京、大连)
Google站内搜索


相关链接: