嗨,我正在爲我的網站在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