Flex Tree组件Demo
这个DEMO可以创建一个全新的树型结构,让我感到奇怪的是,虽然我用XML而不是XMLListCollection/ArrayCollection作为Tree的数据源,但对XML的更新依然会在Tree中反映出来——这似乎和Flex的文档有冲突,下面是引用Flex文档的一段内容:
Raw objects are often not sufficient if you have data that changes, because the data provider component does not receive a notification of any changes to the base object. The component therefore does not get updated until it must be redrawn due to other changes in the application, or if the data provider is reassigned. At that time, it gets the data again from the updated raw object.
Here is the demo(怎么插入swf文件?用embed标签?)
Source code here:
<?xml version="1.0"?>
<!-- dpcontrols/TreeSimple.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" fontSize="12">
<mx:Script>
<!--[CDATA[
import mx.collections.ArrayCollection;
import mx.collections.XMLListCollection;
[Bindable]
private var list:XML = <list/>;
public function onBtnAddNodeClick(e:Event):void
{
var newNodeName:String = nodeName.text;
if(newNodeName.length == 0)
return;
var currentNode:XML = XML(tree.selectedItem);
if(currentNode == null || currentNode.@type!=1)
return;
var newNode:XML = <node/>;
newNode.@label = newNodeName;
newNode.@type= 1;
newNode.@isBranch = true;
currentNode.appendChild(newNode);
}
public function onBtnAddTopNodeClick(e:Event):void
{
var newNodeName:String = nodeName.text;
if(newNodeName.length == 0)
return;
var newNode:XML = <node/>;
newNode.@label = newNodeName;
newNode.@type= 1;
newNode.@isBranch = true;
list.appendChild(newNode);
}
public function onBtnDelNodeClick(e:Event):void
{
var currentNode:XML = XML(tree.selectedItem);
if(currentNode == null)
return;
var sibling:X
相关文档:
页面代码:
<?xml version="1.0"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:marsImage="mars.display.*"
backgroundColor="#000000"
layout="absolute">
<marsImage:BorderImage
borderAlpha="{aBar.value ......
注意:本机必须连接互联网
效果图:
源码如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" creationComplete="init()">
<mx:Panel width="620" height="455" layout="absolute" title="天气预报" fontSize="12">
......
其实一般的情况下是不会用到这种情况的,一般在程序里,比如选中要填写的项目,都喜欢有一个选中的状态,但是现在我们来个反其道而行,如果我不想要这个状态该怎么办呢?
参考了些资料,其实也简单,有好几种方法,但是发现了一个最有用的方法,首先我们在舞台上随意放几个TEXTINPUT ......
flex repeater控件注意
Repeater 顾名思义,Repeat就是重复的意思, Repeater 就是用来重复的控件
Repeater 会根据数据源中对象的多少来产生多少个子项,生成的子项全部是以数组形式存在的
<mx:Repeater id="myRepeater" dataProvider="{myArray}">
<mx:HBox> ......
1、as3ebaylib
http://code.google.com/p/as3ebaylib/
2、as3youtubelib
http://code.google.com/p/as3youtubelib/
3、as3flickrlib
http://code.google.com/p/as3flickrlib/
4、Yahoo ASTRA Flash Components
http://developer.yahoo.com/flash/astra-flash/
5、facebook-as3
http://code.google.com/p/faceboo ......