关于Flex查询信息并显示的问题?那个高手帮忙解答下谢谢了.

SWQQ- 2009-12-25 08:16:15
这是配置文件的内容所有的信息都从这里取

<?xml version="1.0" encoding="utf-8"?>
<root>
<command id="1" label="login" description=" login The HPUX System." section="Section One"/>
<command id="2" label="exit" description=" logoff The HPUX System." section="Section One"/>
<command id="3" label="id" description=" Display your user and group identifications." section="Section One"/>
<command id="4" label="who" description=" Identify other users logged on to the system." section="Section One"/>
<command id="5" label="date" description=" Display system date and time." section="Section One"/>
<command id="6" label="passwd" description=" Assign a password to your user account." section="Section One"/>
<command id="7" label="echo" description=" Display simple messages to your screen." section="Section One"/>
<command id="8" label="banner" description=" Coding & Unit Testing." section="Section One"/>
<command id="9" label="clear" description=" Clears terminal screen." section="Section One"/>

<command id="10" label="pwd" description=" Displays the directory name of your current location in the hierarchy." section="Section Two"/>
<command id="11" label="ls" description=" Sees what files and directories are under the current directory." section="Section Two"/>
<command id="12" label="cd" description=" Changes your location in the hierarchy to another directory." section="Section Two"/>
<command id="13" label="find" description=" Finds files." section="Section Two"/>
<command id="14" label="mkdir" description=" Creates a directory." section="Section Two"/>
<command id="15" label="rmdir" description=" Removes a directory." section="Section Two"/>
<command id="16" label="ls" description=" Look at the characteristics of a file." section="Section Two"/>
<command id="17" label="cat" description=" Look at the contents of a file." section="Section Two"/>
<command id="18" label="more" description=" Look at the contents of a file." section="Section Two"/>
<command id="19" label="cp" description=" Make a copy of a file" section="Section Two"/>
<command id="20" label="mv" description=" Change the name of a file or directory." section="Section Two"/>
<command id="21" label="mv" description=" Move a file to another directory." section="Section Two"/>
<command id="22" label="ln" description=" Create another name for a file." section="Section Two"/>
<command id="23" label="rm" description=" Remove a file." section="Section Two"/>
<command id="24" label="ls(ll, ls –l)" description=" Determine what access is granted on a file chmod Change access." section="Section Two"/>
<command id="25" label="umask" description=" Change default file access." section="Section Two"/>
<command id="26" label="touch" description=" Update timestamp on file." section="Section Two"/>
<command id="27" label="chown" description=" Change the owner of a file." section="Section Two"/>
<command id="28" label="chgrp" description=" Change the group of a file." section="Section Two"/>
<command id="29" label="su" description=" Switch your user identifier." section="Section Two"/>
<command id="30" label="newgrp" description=" Switch your group identifier." section="Section Two"/>

<command id="31" label="ps [-efl]" description=" Report process status." section="Section Three"/>
<command id="32" label="Ctrl+Z" description=" Putting jobs in Background/Foreground." section="Section Three"/>
<command id="33" label="nohup" description=" Makes a command immune to hangup." section="Section Three"/>
<command id="34" label="nice[-N]" description=" Runs aprocess at alower priority N is a number between 1 and 19." section="Section Three"/>
<command id="35" label="kill[-s signal_name]PID [PID...]" description=" sends a signal to specified processes." section="Section Three"/>

</root>





这是TitleWindows组建

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="492" height="364" title="Command Reference" showCloseButton="true" close="PopUpManager.removePopUp(this);" color="#F1F8F9">

<mx:Script>

<!--[CDATA[
private function init():void

{

var url:URLRequest = new URLRequest("command-info.xml");

var loader:URLLoader = new URLLoader();

loader.addEventListener(Event.COMPLETE,onComplete);

loader.load(url);

}

private function onComplete(event:Event):void{

var result:URLLoader = URLLoader(event.target);

datas = XML(result.data);

}

]]-->

</mx:Script>

<mx:Script>
<![CDATA[

import mx.collections.ICollectionView;
import mx.events.ListEvent;

/*
* Point area through the contents of the drop-down menu start
*/
private function tree_itemClick(evt:ListEvent):void {

//Define the point add Tree Event use come true contents of the drop-down menu start
var item:Object = Tree(evt.currentTarget).selectedItem;

//According the condition judge the point content
if (treeXML.dataDescriptor.isBranch(item)) {

treeXML.expandItem(item, !treeXML.isItemOpen(item), true);
}
}

/*
* Request the node of number
*/
private function tree_labelFunc(item:XML):String {

var children:ICollectionView;

var suffix:String = "";

if (treeXML.dataDescriptor.isBranch(item)) {

children = treeXML.dataDescriptor.getChildren(item);
suffix = " (" + children.length + ")";
}
return item[treeXML.labelField] + suffix;
}
]]>
</mx:Script>

<mx:Script>
<![CDATA[

/*
* Default show all node of contents
*/
private function initApp():void {
for each(var item:XML in this.treeXML.dataProvider)
this.treeXML.expandChildrenOf(item,true);
}
]]>
</mx:Script>

<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;

[Bindable]
public var selectedNode:XML;

// Event handler for the Tree control change event.
public function treeChanged(event:Event):void {
selectedNode=Tree(event.target).selectedItem as XML;
}
[Bindable]
[Embed("images/skin/titlewindow/titleWindowBg.png")]
public var VBoxBg:Class;
[Bindable]
[Embed("images/tree/icon/point.png")]
public var point:Class;
]]>

</mx:Script>


<mx:XML id="dynamicTreeXML" source="assets/configfiles/commandTwo-info.xml"/>
<mx:VBox x="30" y="10" height="284" width="432">
<mx:Tile width="429" height="23">
<mx:Label text="A B C D E F G H I Z K L M N O P Q R S T U X Y Z" width="418" height="23" fontWeight="bold" fontSize="13" fontFamily="Georgia" color="#3291C3"/>
</mx:Tile>
<mx:Label text="Select Command" width="104" height="23" fontSize="12" color="#3291C3" fontWeight="bold"/>
<mx:HBox width="423" height="226">
<mx:Tree id="treeXML" change="treeChanged(event)" creationComplete="initApp()" dataProvider="{dynamicTreeXML}" labelField="@label" labelFunction="tree_labelFunc" itemClick="tree_itemClick(event)" rowCount="6" showRoot="false" width="200" height="224" backgroundColor="#E2F5FA" color="#3291C3"/>
<mx:TextArea width="210" height="223" color="#3291C3" text="{selectedNode.@description}" />
</mx:HBox>
</mx:VBox>

</mx:TitleWindow>


我的问题是通过怎样的方式在点击 A B C D E F。。。。。。也就是定义的首字母时,在左边的Tree中显示XML定义的信息里相关字母开头的Command ?
A B C D 怎样定义才能是可点击的,本人新手很多都不懂,希望大家多多提意见 或者是用其他的方法实现这样的功能,多多指点。
...全文
200 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
SWQQ- 2009-12-26
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 xingjunli 的回复:]
ABCDEF。。。应该分开不同组件以响应查询事件
2、mx:Tree应该绑定一个查询结果:
xml查询如:dynamicTreeXML. command.(contains(@label,'A'))
[/Quote]

具体的绑定应该是怎么设置的?mx:Tree 具体查询结果绑定的?能帮忙详细的解释下可以不?
xingjunli 2009-12-26
  • 打赏
  • 举报
回复
ABCDEF。。。应该分开不同组件以响应查询事件
2、mx:Tree应该绑定一个查询结果:
xml查询如:dynamicTreeXML. command.(contains(@label,'A'))
SWQQ- 2009-12-26
  • 打赏
  • 举报
回复
感谢你的解答,我试验了下 好像不行,也针对的修改了一些还是不行,能不能麻烦多费些心,帮我解决它,谢谢了。
xingjunli 2009-12-26
  • 打赏
  • 举报
回复
如(思路没做测试):

[Bindable]
private var xmlValue:XMLListCollection;
private function queryXML(par:String):void
{
xmlValue = dynamicTreeXML.command.(contains(@label,par))
}
<mx:Tree id="treeXML" dataProvider="{xmlValue }" labelField="@label" />
..
SWQQ- 2009-12-25
  • 打赏
  • 举报
回复
没有人能解答吗?

4,328

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计 Flex
社区管理员
  • Flex
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧