大猴子的花果山

Doing ActionScript...
    <<  我的办公窝.不知道不觉在这里坐快一年了. | 首 页 | labs开放FC和FB4的public beta下载[转自7yue.com]  >>
  • 2009-05-28

    Flex Tree 使用外部图片做ICON - [Flex]

    Tag:FLEX TREE 外部 ICON

    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
    http://25swf.blogbus.com/logs/40077269.html

    Flex 中 组件的 icon字段只能 是一个Class 或一个Class 的字符串名字,如果要在组件中使用外部图片做为图标,还需要另外写一些代码.以下是为TREE使用外部图片做为ICON的一个类,使用时,你需要设置tree的iconFunction方法,并反回该类做为图标的类

    package Unit
    {
     import flash.events.Event;
     import flash.utils.Dictionary;
     
     import mx.containers.VBox;
     import mx.controls.Image;

     
     public class IconClass extends VBox
     {
      //字典,避免同一个ICON重复加载,出现闪屏
      static public var alliconsimage:Dictionary = new Dictionary();
      public function IconClass()
      {
       super();
       this.addEventListener(Event.ADDED_TO_STAGE,onAddToStage);
      }
      public function onAddToStage(e:Event):void
      {
       if(alliconsimage[Object(this.parent).listData.item] == null)
       {//字典中没有该item的图标
        alliconsimage[Object(this.parent).listData.item] = new Image();
        alliconsimage[Object(this.parent).listData.item].source = Object(this.parent).listData.item.@icon.toXMLString();//加载
       }
       //this.source = Object(this.parent).listData.item.@icon.toXMLString()
       if(this.numChildren==0)//没有添加过icon
        this.addChild(alliconsimage[Object(this.parent).listData.item]);
      }
     }
    }


    随机文章:

    FLEX 做界面的搜索引擎 2007-10-31
    魅力点滴 2011-03-08
    Hagoot Desktop Demo 2009-04-24
    AS3 ICellRenderer 的一个示例 2008-01-10
    Boostworthy Animation System AS3 的Tween 2007-11-05

    收藏到:Del.icio.us
    引用地址:
    25swf 发表于19:05 | 编辑 | 继续话题 | 转发 | 分享 0

搜索

最新日志

  • python 中获取utf8 包含中文字符的字符窜的实际长度
  • Python + twister 效率相关
  • 经典百万富翁小游戏
  • SWFKit UTF8支持
  • 使用Base64 给 SWFKit 传递ByteArray
  • labs开放FC和FB4的public beta下载[转自7yue.com]
  • Flex Tree 使用外部图片做ICON
  • 我的办公窝.不知道不觉在这里坐快一年了.
  • VS2005不能新建Win32 智能设备项目 的解决办法
  • iphone 上运行WOW??[视频]
全部日志>>

最新评论

  • grant:傻逼
  • grant:还研究这个了,靠,哈哈...
  • mathgl:那个bug..不知道 2.5.2有没有......
  • 恶心的膜:恶心的笔记本键盘膜
  • 小曹:1个人要用3台吗?
  • asfox:强悍的办公桌!!
  • 好容易:真的很容易,你们这群傻A。...
  • tristan:大虾你好!请问我绘制出的图形太小应该怎么调整啊?如果整体...
  • zz:你好。我看到网上你介绍一篇日本flashlite的文章。...
  • 12222222212:谁这么装B?? 你不用修改器把第六关过到95局的截图发...
Display Pagerank
  • RSS 什么是RSS?
    用IM提醒我内容更新
    订阅到QQ邮箱
    订阅到鲜果阅读器
    订阅到Google阅读器
    订阅到抓虾阅读器
  • 《城客》第四期:创意之城
    博客大巴
    博客大巴使用指南
    博客大巴模板中心
    免费注册博客大巴
    一键博客搬家工具
    中文互动杂志城客
Copyright © 2002-2009 BlogBus.com, All Rights Reserved. 博客大巴 版权所有
博客大巴模板设计:leda | 作者: leda