测试文件代码如下:导入com.hillelcoren.components包
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:hc="com.hillelcoren.components.*"
xmlns:classes="com.hillelcoren.components.autoComplete.classes.*"
xmlns:local="*"
width="100%" height="100%" color="#000000"
verticalAlign="top" horizontalAlign="left"
paddingLeft="20" paddingTop="15" paddingBottom="20" paddingRight="20"
initialize="init()">
<mx:Script>
<![CDATA[
import mx.utils.ObjectUtil;
import mx.events.MenuEvent;
import com.hillelcoren.components.AutoComplete;
import mx.core.Application;
import mx.core.UIComponent;
import mx.collections.ArrayCollection;
[Bindable]
public var colors:ArrayCollection;
[Bindable]
public var datas:ArrayCollection;
private function init():void
{
datas = new ArrayCollection(["131","132","130","Axx","Ddd cc","xxx yyy","133","134","135","136",
"137","138","139","150","158","159",
"广东 广州","Bxx Baa","上海","张三","李四","Aadla","Asf sf",
"Bxv sfs","Abort XXX","Asp Php"]);
}
public function dd():void{
test.text = autoComplete.text;
}
]]>
</mx:Script>
<mx:HBox width="100%" minWidth="200">
<mx:Text id="test" />
<hc:AutoComplete id="autoComplete" dataProvider="{ datas }" labelField="name" matchType="anyPart"
prompt="Choose your favorite Crayola crayon" width="100%"
allowNewValues="true" selectedItemStyleName="{ AutoComplete.STYLE_UNDERLINE }" backspaceAction="focus"
allowDuplicates="true" allowMultipleSelection="true"
allowEditingNewValues="true" />
<mx:Button label="Button" click="dd()"/>
</mx:HBox>
</mx:Application>