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

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

时间:2014-05-08 23:02:06      阅读:303      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   java   tar   

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图标

标签:style   blog   class   code   java   tar   

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

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