- 浏览: 542234 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
coosummer:
推荐使用http://buttoncssgenerator.c ...
【转载】CSS圆角按钮(一) -
saiarmuluo:
不错,支持。
java log4j日志 写入数据库 -
springdata_springmvc:
spring mvc demo教程源代码下载,地址:http: ...
Freemarker 使用 -
zlbdexiaohao:
棒棒的
flex ToolTip汇总 -
hw_128:
demo的代码的,能不能发一下,谢谢 qq257515270 ...
java log4j日志 写入数据库
1.tree 改变每一项的 icon图标
<?xml version="1.0" encoding="utf-8"?> <s:Application 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:myflexhero="http://www.myflexhero.com/share/flex3-mx/flex-mx-core-components/flex-mx-ui-controls/flex-mx-tree-and-datagrid-controls/909" minWidth="955" minHeight="600" viewSourceURL="srcview/index.html"> <s:layout> <s:VerticalLayout/> </s:layout> <fx:Script> <![CDATA[ [Bindable] [Embed(source="assets/myflexhero.png")] public var myflexhero:Class; [Bindable] [Embed(source="assets/yellow.png")] public var yellow:Class; ]]> </fx:Script> <mx:Tree iconField="@icon" labelField="@label" showRoot="false" width="160"> <fx:XMLList> <node label="My"> <node label="Flex Document" icon="myflexhero"/> <node label="Hero Document" icon="yellow"/> </node> <node label="com" icon="myflexhero"/> </fx:XMLList> </mx:Tree> </s:Application>
2.改变所有图片样式
<?xml version="1.0" encoding="utf-8"?> <s:Application 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:myflexhero="http://www.myflexhero.com/share/flex3-mx/flex-mx-core-components/flex-mx-ui-controls/flex-mx-tree-and-datagrid-controls/909" minWidth="955" minHeight="600" viewSourceURL="srcview/index.html"> <s:layout> <s:VerticalLayout/> </s:layout> <fx:Script> <![CDATA[ ]]> </fx:Script> <mx:Tree folderOpenIcon="@Embed(source='1.png')" showRoot="false" labelField="@label" width="600" folderClosedIcon="@Embed(source='2.png')" defaultLeafIcon="@Embed(source='3.png')"> <fx:XMLList> <node label="My" icon="yellow1"> <node label="Flex Document" icon="myflexhero"/> <node label="Hero Document" icon="yellow"/> </node> <node label="com" icon="myflexhero"/> </fx:XMLList> </mx:Tree> </s:Application>
1、默认的Tree的属性是文件夹和文件都是通过 folderOpenIcon, folderClosedIcon, and defaultLeafIcon 来执行的,如果在程序中需要取得默认的参数可以通过这几个参数进行处理
var myMenu:SysMenu = SysMenu(item); if(myMenu.children.length==0){ return leftMenuTree.getStyle("defaultLeafIcon"); } if ( leftMenuTree.isItemOpen(item) ) { return leftMenuTree.getStyle("folderOpenIcon"); } else { return leftMenuTree.getStyle("folderClosedIcon"); }
当然也可以直接通过flex的标签来制定
<mx:Tree folderOpenIcon="@Embed(source='open.jpg')"folderClosedIcon="@Embed(source='closed.jpg')"defaultLeafIcon="@Embed(source='def.jpg')">
2、通过data provider来提供数据源的时候就指定icon
<mx:XMLList> <node label="New"> <node label="HTML Document" icon="iconSymbol2"/> <node label="Text Document" icon="iconSymbol2"/> </node> <node label="Close" icon="iconSymbol1"/> </mx:XMLList>
3、通过函数setItemItcon
[Bindable] [Embed(source="assets/radioIcon.jpg")] public var iconSymbol1:Class; [Bindable] [Embed(source="assets/topIcon.jpg")] public var iconSymbol2:Class; private function setIcons():void { myTree.setItemIcon(myTree.dataProvider.getItemAt(0), iconSymbol1, iconSymbol2); myTree.setItemIcon(myTree.dataProvider.getItemAt(1), iconSymbol2, null); }
4、Tree支持显示icon的属性iconFunction ,自定义处理函数就可以了,示例如下
<!-- -->
<?xml version="1.0" encoding="utf-8"?> <s:Application 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:myflexhero="http://www.myflexhero.com/share/flex3-mx/flex-mx-core-components/flex-mx-ui-controls/flex-mx-tree-and-datagrid-controls/909" minWidth="955" minHeight="600" viewSourceURL="srcview/index.html"> <s:layout> <s:VerticalLayout/> </s:layout> <fx:Script> <![CDATA[ import mx.collections.XMLListCollection; [Embed(source="1.png")] //这是图片的相对地址 [Bindable] public var OKicon:Class; [Embed(source="2.png")] //这是图片的相对地址 [Bindable] public var NOicon:Class; //设置不同图表 private function iconFun(item:Object):* { var xml:XML = item as XML; if(xml.attribute("bool") == true) return OKicon; else if(xml.attribute("bool") == false) return NOicon; } ]]> </fx:Script> <fx:Declarations> <mx:XMLListCollection id="datatree" > <fx:XMLList> <node label="NO1" bool="false"> <node label="NO11" bool="false"> <node label="NO111" bool="false"/> </node> <node label="NO22" bool="true"/> </node> <node label="NO2" bool="true"> <node label="NO11" bool="false"> <node label="NO111" bool="false"/> </node> <node label="NO22" bool="true"> <node label="NO222" bool="false"/> </node> </node> </fx:XMLList> </mx:XMLListCollection> </fx:Declarations> <mx:Tree id="tree" y="40" width="100%" height="100%" fontFamily="Arial" fontSize="12" dataProvider="{datatree}" labelField="@label" iconFunction="iconFun" /> </s:Application>
附件为代码:2种方式1.folderOpenIcon 形式,2.inconFunction方式
发表评论
-
Flex4 模块 [转载]
2012-11-05 09:30 0使用flex4模块(1):传递数据到模块 在主程序与模块 ... -
Flex4 List改变了dataProvider,怎么锁定选中Item【转载】
2012-11-05 09:29 1041sfList.dataProvider = sfData; i ... -
解决flex嵌入字体导致文件过大的问题[转载]
2012-11-05 09:25 0众所周知,Flex嵌入字体 ... -
flex DataGrid 行列颜色设置
2012-05-06 20:00 9108群里一哥们问了个问题,就写了个这个demo DataGrid ... -
flex4 Spark DataGrid,title的字体居中
2012-03-20 21:23 6237【原创】flex4 Spark DataGrid,title的 ... -
flex4 Application backgroundImage
2012-03-10 15:13 2828群里一哥们问我 f4 设置 Application 的 bac ... -
flex 无法将“<mx:>”解析为组件执行.解决办法:
2012-03-09 16:34 8256flex项目导入早期版本 无法将“<mx:******& ... -
flex component 去掉点击加亮边框
2012-03-09 16:35 1050群里有人问我怎么去掉TextInput的文本框加亮。写下来 ... -
flex ProgressBar skin 修改
2012-03-09 16:36 2868f3的形式修改border: 其中 barSkin 是外边框 ... -
flex Draggable Flex Components
2012-03-08 20:38 941Creating Resizable and Draggabl ... -
flex 3d云标签
2012-03-08 20:37 1513来自:http://downloads.wordpress.o ... -
AS html 形式超链接设置
2012-03-08 20:36 1617lbl.htmlText = " <b& ... -
flex IViewCursor 的应用
2012-03-08 20:35 1058IViewCursor 的应用 demo 效果图:可以上下 ... -
f4 spark 占位控件
2012-03-08 20:33 929halo的占位控件。<mx:Spacer width=& ... -
halo的grid DataGridColumn itemRenderer 混用 spark 组件
2012-03-03 14:20 1382halo的grid DataGridColumn itemRe ... -
flex DeferredInstanceFromFunction 使用
2012-03-02 21:54 1556flex DeferredInstanceFromFuncti ... -
flex ContextMenuItem 根据状态隐藏选项
2012-02-27 18:28 1359因群里一个群员的要求,写了这个demo,代码粗糙,根据一个控件 ... -
动态设置itemRenderer
2012-02-18 19:34 0<mx:TileList id="tl&quo ... -
【转】解决RemoteClass alias信息丢失
2012-02-18 19:15 765问题发生场景:flex程序中存在多个module都调用一个标记 ... -
flex 发光区域控制
2012-02-05 10:59 0<mx:Application xmlns:mx=&qu ...
相关推荐
flex 修改 tree的icon,根据数据源root 中不同的参数修改不同的图片。
flex tree 复选框,以及父目录的三种状态。(全部选中,部分选中,没有选中)
flex tree 教程二
flex tree+checkbox可实现级联勾选
里面收集了一些Flex的tree控件的用法和实例的源代码
flex tree 拖拽,flex tree 节点移动。
去掉flex tree控件默认的图标并加上线连接。
本资源中包括Tree的文件和Tree的渲染文件(Checkbox),实现功能为点击树不获取值(也可以获取,改变一个变量即可),只有勾选Checkbox才能得到。并添加到集合中
在网上找到了关于flex 的tree在前面加上checkbox, 我经过改动, 现在很适合使用。
flex tree+checkbox可实现级联勾选 修改后 修改CheckTreeDemoRenderer.as这个文件中 while (!cursor.afterLast){ if (cursor.current.@state == STATE_CHECKED) { noChecks++; }else if (cursor.current.@state =...
flex带复选框的tree,包含源代码,需要用到的朋友请下载
快速定位输入结点名称,点击“检索”后打开树中对应结点
flex tree 自动显示横向滚动条 自定义重写
Flex Tree 刷新数据源后,重新打开指定节点的解决方案,不需要延迟等其他手段
Flex Tree增加虚线连接,绘制虚线连接样式
前些日子看网上只有虚线连接的例子,无聊就给改了改
有时候tree节点内容太长,就需要用toolTip来实现鼠标滑过时提示全部内容。用两种方式实现. 1.通过itemRollOver和itemRollOut,使用ToolTipManager自定义实现 2.树本身属性showDataTips,加了一些小优化。 ...
Flex、Java 、Tree代码 使用XMLList生成xml文件
Flex右键菜单 flex tree 右键菜单 导入eclipse可直接用。我使用的flex sdk 版本是flex4.5.1,更改为4.0可直接使用。