Flex 文本框的输入下拉提示

    复制代码 代码如下:

    <?xml version=”1.0″ encoding=”utf-8″?>
    <mx:FormItem xmlns:mx=”http://www.adobe.com/2006/mxml” label=”” required=”true” width=”305″ fontWeight=”bold” height=”28″ horizontalAlign=”right” textAlign=”center” fontStyle=”normal”>

            <mx:Script>
            <!–[CDATA[            
                import mx.managers.PopUpManager;
                import mx.controls.Text;
                import mx.rpc.events.ResultEvent;
                import Scripts.ToolHelper;        

                //public var _win:PortWindow=new PortWindow();
                [Bindable]
                private var PortName:Text=new Text();

                private function DropPorts_KeyDown(event:KeyboardEvent):void
                    {                    
                        if(this.DropPorts.editable==false)return;
                        this.DropPorts.close();
                        if(event.keyCode==Keyboard.ENTER)
                        {    
                            this.DropPorts.prompt=this.DropPorts.text;
                            if(this.DropPorts.text.length<2)return;
                            this.HttpPort.cancel();
                            this.HttpPort.url=”your url here”;
                            this.HttpPort.addEventListener(ResultEvent.RESULT,HttpPort_result)    
                            this.HttpPort.send();
                        }
                        else
                        {    
                        }
                    }
                private function HttpPort_result(event:ResultEvent):void
                {
                    this.DropPorts.open();
                }    
                ]]–>
            </mx:Script>

            <mx:HTTPService id=”HttpPort” method=”GET” />
            <mx:ComboBox id=”DropPorts” keyDown=”DropPorts_KeyDown(event);”
                 labelField=”Name”
                 dataProvider=”{HttpPort.lastResult.CityOcean.Port}” width=”170″ editable=”true” textAlign=”left”></mx:ComboBox>
            <mx:Text id=”txtPortID” visible=”false” height=”0″ width=”0″ text=”{DropPorts.selectedItem.ID}” />        

    </mx:FormItem>

发表评论

发表评论