Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 405

Programming actionscript 3.0
Table of Contents

Advertisement

The Telnet application files can be found in the Samples/Telnet folder. The application
consists of the following files:
File
TelnetSocket.mxml
com/example/programmingas3/Telnet/
Telnet.as
Telnet socket application overview
The main TelnetSocket.mxml file is responsible for creating the user interface (UI) for the
entire application.
In addition to the UI, this file also defines two methods,
connect the user to the specified server.
The following code lists the ActionScript in the main application file:
import com.example.programmingas3.socket.Telnet;
private var telnetClient:Telnet;
private function connect():void
{
telnetClient = new Telnet(serverName.text, int(portNumber.text), output);
console.title = "Connecting to " + serverName.text + ":" +
portNumber.text;
console.enabled = true;
}
private function sendCommand():void
{
var ba:ByteArray = new ByteArray();
ba.writeMultiByte(command.text + "\n", "UTF-8");
telnetClient.writeBytesToSocket(ba);
command.text = "";
}
Description
The main application file consisting of the MXML
user interface.
Provides the Telnet client functionality for the
application, such as connecting to a remote server,
and sending, receiving, and displaying data.
login()
Example: Building a Telnet client
and
, to
sendCommand()
405

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents