<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.net.Socket;
public var m_socket:Socket = new Socket();
public function connect():void{
if(m_socket.connected == false){
m_socket.connect("localhost", 8080);
}
}
public function close():void{
if(m_socket.connected == true){
m_socket.writeUTFBytes("EXIT" + "\n");
m_socket.close();
}
}
public function sendData():void
{
if(m_socket.connected == true)
{
m_socket.writeUTFBytes( txtData.text);
m_socket.flush();
}
else
{
Alert.show("연결되지 않았음");
}
}
]]>
</mx:Script>
<mx:VBox>
<mx:HBox>
<mx:Button label="connect" click="connect()"/>
<mx:Button label="close" click="close()" />
</mx:HBox>
<mx:HBox>
<mx:TextInput id="txtData"/>
<mx:Button label="send" click="sendData()"/>
</mx:HBox>
</mx:VBox>
</mx:Application>
'Robotics > Software Tech.' 카테고리의 다른 글
소프트웨어 성능 평가 (0) | 2008.02.15 |
---|---|
windows embedded xp step by step guide (0) | 2008.02.10 |
Flex 관련 pdf 자료모음 (2) | 2008.01.31 |
Flex에서 XML 파싱 방법 (1) | 2008.01.29 |
Flex MXML에서 초기화할때 스크립트가 실행되게 하려면.. (0) | 2008.01.29 |