Flash through the Xmlsocket Monitoring production system (2-3)

Source: Internet
Author: User
Tags object connect socket port number
xml| Monitoring

3 input field text (input text)

As with dynamic text, it is also an instance of a TextField object that can be set to a unique instance name in the Flash property inspector, and can then use the instance name to change the content and style of the dynamic text, as with dynamic text, which allows the user to enter and has cut, copy, paste, select all and other editing functions.

In the application case described in this article, you use the input box text to allow the user to enter the host and port to which you want to connect the socket:

function Btnconnect_onclick () {

if (Txtport.text < 1024 | | Txtport.text > 65536) {

Txtport.text = "";
Selection.setfocus ("_root.txtport");
Txtport.backgroundcolor = "0xff0000";
}else{

if (Txthost.text = = "Default Host") {

Socket.connect (null, txtport.text);
}else{

Socket.connect (Txthost.text, Txtport.text);
}
}
}

The above statement is a click event handler for the Btnconnect button (an instance of the application development component pushbutton), where the function name is set to Btnconnect_onclick, just to make it easier to understand, Just set the Btnconnect click Handler (click the event handler) to the appropriate function in the property inspector. Txthost and Txtport each allow the user to enter an input domain (TextField) object that connects the host to the port.

When the user clicks the Btnconnect button, first determines whether the user enters the port number between 1024 and 65565, if not, txtport the contents of the Port Input box blank, the background turns red, and the following statement gets the input focus Selection.setfocus (" _root.txtport "), let the user re-enter. Since the contents of the Txtport port input box must be numeric, you can set the user to enter only numbers, and when the user enters again, the background of the port input box is changed to the original color:

Txtport.restrict = "0-9";
txtport.onchanged = txtport_onchanged;

When the input box text is generated, the default Txthost content is "default host" and if the user does not change before connecting, connect the IP address of the Web server and, if the user enters a host, ensure that the connected host is in the same IP address or the same subdomain as the Web server.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.