嗨,我正在为我的网站在Flex中使用搜索工具。我希望它能像MAC桌面上的“Spotlight”工具一样工作。 “http://www.recipester.org/images/6/66/How_to_Use_Spotlight_to_Search_on_Mac_OS_X_42.png”链接是聚光灯下的图像。在全局搜索工具上工作 - 就像在MAC上一样
我想在FLEX中创建几乎相同的东西。 我目前拥有的是一个“自动完成”框,并且我可以获得所有我想要的数据。代码自动完成低于:
<auto:AutoComplete borderStyle="none" id="txt_friends_search"
textAlign="left" prompt="Search Friends" dataProvider="{all_friends_list}"
allowEditingNewValues="true" allowMultipleSelection="true" allowNewValues="true"
backspaceAction="remove" labelField="label"
autoSelectEnabled="false" matchType="anyPart"
height="23" right="400" top="1" dropDownItemRenderer="{new ClassFactory(weather.index_cloud_global_search_item_renderer)}" />
而且我ItemRenderer的样子:
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox
xmlns:mx="http://www.adobe.com/2006/mxml"
width="100%" height="100%"
verticalGap="0" horizontalGap="0"
creationComplete="init()"
verticalScrollPolicy="off" horizontalScrollPolicy="off"
verticalAlign="middle">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
import com.hillelcoren.utils.StringUtils;
import mx.utils.StringUtil;
import mx.events.FlexEvent;
import mx.controls.List;
public function init():void
{
}
]]>
</mx:Script>
<mx:HBox width="100%" verticalGap="0" horizontalGap="0">
<mx:HBox borderThickness="1" width="75" borderStyle="solid" horizontalAlign="left" horizontalScrollPolicy="off">
<mx:Label id="type" text="{data.type}" fontSize="12"/>
</mx:HBox>
<mx:HBox borderThickness="1" width="75" borderStyle="solid" horizontalAlign="left" horizontalScrollPolicy="off">
<!--mx:Label id="nameLabel" text="{data.label}" fontSize="12"/-->
<mx:List id="names" dataProvider="{all}"
</mx:HBox>
</mx:HBox>
<!--mx:Box id="colorBox" borderStyle="solid" width="50" height="25"/-->
<mx:Spacer width="15"/>
这说明类型和所有的标签,例如:
- 好友ABC
- 朋友XYZ 条
- 消息这是消息的消息
- 消息示例文件FILENAME1
- 文件filename123
我相信你明白我的意思存在。
但我想制作的是一样的东西:
好友ABC XYZ 消息这是消息 消息 示例文件,文件名1 filename123 MoreFiles
有人可以PLZ帮我在这。 我其实不知道该如何向前迈进。
让我知道你是否想对任何事情做更多的澄清。
问候 Zeeshan
只是一个说明:Mac不是一个缩写。 :) – Jeff 2010-01-26 16:00:16