[转] Spark Tree

 

源文: http://kachurovskiy.com/2010/spark-tree/

最新的code在 github: https://github.com/kachurovskiy/Spark-Tree

非常可惜, Flex 4 没有 Spark Tree,而 MX Tree 现在还有99个bug.

在我的项目中我需要一个基于Spark的Tree控件, 在Alex Harui的鼓励下我写了一个:

Alex Harui的文章: http://blogs.adobe.com/aharui/2009/12/displaying_tree-like_hierarchi.html

Download SparkTree.swc
Download source code

Creating tree item renderers

Tree item renderers should extend TreeItemRendererHere is the default item renderer.

Found a bug under flex_sdk_4.5.1.21328:

Today(2011/06/29), I check the latest code from github, but I found a bug:

RangeError: Index '1' specified is out of bounds. at mx.collections::ListCollectionView/getItemAt() at com.sparkTree::TreeDataProvider/getItemAt()

test.mxml

<?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:tr="com.sparkTree.*"
               xmlns:mx="library://ns.adobe.com/flex/halo">
	
	<fx:Declarations>
		<s:XMLListCollection id="foldersTreeData">
			<fx:XMLList>
				<folder label="branch1" data="19">
					<folder label="branch2" data="16">
						<folder label="Click Me will trigger exception" data="17" isBranch="true"/>
					</folder>
				</folder>
			</fx:XMLList>
		</s:XMLListCollection>
	</fx:Declarations>
	
	<tr:Tree dataProvider="{foldersTreeData}" 
				 width="400" height="100%" itemRenderer="com.sparkTree.DefaultTreeItemRenderer"
				 useVirtualLayout="false" dragEnabled="false" dropEnabled="false" labelField="@label"
				 >
			<tr:layout>
				<s:VerticalLayout />
			</tr:layout>
	</tr:Tree>
	
</s:Application>

sdfsdfs

smithfox | Saturday 26 February 2011 at 5:09 pm | | UI        | Used tags: , ,

six comments

smithfox

bug已经解决, 见 http://www.smithfox.com/?e=155

smithfox, (URL) - 30-06-’11 15:59
smithfox

mark another spark tree:

https://github.com/wasbridge/flex-4-tree

smithfox, (URL) - 30-06-’11 16:08
smithfox

mark a good article that explain the concept about Tree in Chinese:

http://wenku.baidu.com/view/7561a6340b4c..

smithfox, (URL) - 30-06-’11 16:12
Maxim Kachurovskiy

Can not reproduce the RTE while clicking that item with the new https://github.com/downloads/kachurovskiy/Spark-Tree/SparkTree4.5.swc

Maxim Kachurovskiy, (URL) - 02-08-’11 01:02
smithfox

Maxim Kachurovskiy,

Great!!

smithfox, (URL) - 02-08-’11 08:14
YSL iPhone 6 Cases

The Korean company’s Galaxy Note 4 and its midtier Galaxy A series of smartphones have fared particularly badly, the firm says, with sales falling by between 30% and 40%. As a result, it said, “Samsung’s overall market share is not growing despite the relatively successful launch of the Galaxy S6.”

YSL iPhone 6 Cases, (URL) - 04-06-’15 14:04
(optional field)
(optional field)
为阻止垃圾广告, 请在提交评论前, 回答一个简单问题(Please answer an simple question)
Remember personal info?
Notify
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.