码迷,mamicode.com
首页 > 其他好文 > 详细

[Flex] ButtonBar系列——flex3 ButtonBar属性labelPlacement标签相对于指定图标的方向

时间:2015-10-15 12:41:47      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                layout="vertical"
                verticalAlign="middle"
                backgroundColor="white" >
    
    <mx:Script>
        <![CDATA[
            import mx.controls.Button;
            import mx.controls.ButtonLabelPlacement;
            
            [Bindable]
            [Embed("assets/arrow_down.png")]
            private var arrowDown:Class;
            
            [Bindable]
            [Embed("assets/arrow_left.png")]
            private var arrowLeft:Class;
            
            [Bindable]
            [Embed("assets/arrow_right.png")]
            private var arrowRight:Class;
            
            [Bindable]
            [Embed("assets/arrow_up.png")]
            private var arrowUp:Class;
            
            private function init():void {
                var idx:uint;
                var len:uint = buttonBar.numChildren;
                var btn:Button;
                /* Loop over each button. */
                for (idx = 0; idx < len; idx++) {
                    /* Get reference to current Button. */
                    btn = buttonBar.getChildAt(idx) as Button;
                    /* Set labelPlacement property to current item in arr Array object. */
                    btn.labelPlacement = arr[idx].label;
                }
                
            }
        ]]>
    </mx:Script>
    
    <mx:Array id="arr">
        <mx:Object label="left" img="{arrowLeft}" />
        <mx:Object label="right" img="{arrowRight}" />
        <mx:Object label="top" img="{arrowUp}" />
        <mx:Object label="bottom" img="{arrowDown}" />
    </mx:Array>
    
    <mx:ButtonBar id="buttonBar"  dataProvider="{arr}" iconField="img" buttonHeight="64" width="500" creationComplete="init();" />
</mx:Application>

 

[Flex] ButtonBar系列——flex3 ButtonBar属性labelPlacement标签相对于指定图标的方向

标签:

原文地址:http://www.cnblogs.com/frost-yen/p/4881943.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!