首页 > 其他 > 详细

实现flex LinkBar 组件 动态切换ico图标

时间:2014-05-08 23:01:54      阅读:471      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                       xmlns:s="library://ns.adobe.com/flex/spark" 
                       xmlns:mx="library://ns.adobe.com/flex/mx"
                       xmlns:ns="http://www.taxinfo.com" 
                       height="600"
                       width ="800"
                       creationComplete="init()"
                       >  
    <fx:Script>
        <![CDATA[
            import mx.events.ItemClickEvent; 
            [Embed(source=‘xmbz.png‘)]
            private var imgs:Class;
            private var arr:Array = [{name:"1. LinkBar常用属性、方法和事件",value:"1"},{name:"2.通用例子",value:"2"},{name:"3.Flex中如何通过iconField样式,给LinkBar添加Icon图标",value:"3"},{name:"参考文献:",value:"4"}]
            private function init():void
                this.myLink.dataProvider = arr; 
                
            }
            protected function linkbar1_itemClickHandler(event:ItemClickEvent):void
            {
                
                trace( JSON.stringify(arr[event.target.selectedIndex])+"----------------")
                trace( event.target.selectedIndex+"----------------")  
                for(var i:int = 0;i<arr.length;i++){
                    if(i==event.target.selectedIndex){
                        arr[event.target.selectedIndex].ico = imgs; 
                    }
                    else{
                        arr[i].ico = null;
                    }
                }
                 
                this.myLink.dataProvider = arr;
                
            } 
        ]]>
    </fx:Script>
     
    <mx:LinkBar id="myLink"    direction="vertical" labelField="name" iconField="ico"
                itemClick="linkbar1_itemClickHandler(event)" > 
    </mx:LinkBar>
    
</s:WindowedApplication>
bubuko.com,布布扣

实现flex LinkBar 组件 动态切换ico图标,布布扣,bubuko.com

实现flex LinkBar 组件 动态切换ico图标

原文:http://www.cnblogs.com/Frankiln/p/3716703.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!