Use XMLSocket to monitor the production system in flash (2-5)

Source: Internet
Author: User
3) InputText is the same as dynamic text. it is also an instance of the TextField object. you can set a unique instance name for it in the Flash property checker, then you can apply the instance name to apply the corresponding methods and attributes to change 3) Input Text)

Like dynamic text, it is also an instance of the TextField object. you can set a unique instance name for it in the Flash property checker, then, you can apply the instance name to apply the corresponding methods and attributes to change the content and style of dynamic text. what is dynamic text, and has cut, copy, paste, select all and other compilation functions.

In the case above, the text of the input box is used to allow users to enter the host and port to be connected to by establishing a Socket:

Function btnConnect_OnClick (){

If (txtPort. text <1024 | txtPort. text> 65536 ){

TxtPort. text = '';
Selection.setFocus('_root.txt Port ');
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 the click event processing function of the btnConnect button (using an instance of the program development component PushButton), where the function name is set to btnConnect_OnClick, just for ease of understanding, you only need to set the Click Handler (Click event processor) of btnConnect to the corresponding function in the property checker. TxtHost and txtPort tell the user to input the TextField object connecting the host and port.

When you click the btnConnect button, first determine whether the number of ports entered by the user is between 1024 and 65565. if not, leave the txtPort content in the port input box blank and the background turns red, use the following statement to get the input focus Selection.setFocus('_root.txt Port '), so that the user can re-import the data. Because the content of the txt Port input box must be a number, you can set that the user can only enter numbers. at the same time, when the user enters the box again, the background of the port input box is changed to the original color:

TxtPort. restrict = '0-9 ';
TxtPort. onChanged = txtPort_onChanged;

When text is input, the Default txtHost content is "Default Host". if the user does not change before the connection, the IP address of the Web server is connected. if the user enters the Host, ensure that the connected host and Web server are at the same IP address or in the same subdomain.


Related Article

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.