首页 > 开发 > Flex > 正文

Flex 文本框的输入下拉提示

2024-09-12 17:51:25
字体:
来源:转载
供稿:网友
复制代码 代码如下:

<?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>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表