facebook twitter hatena line email

Flash/as3/LocalConnection

提供: 初心者エンジニアの簡易メモ
2015年5月20日 (水) 03:17時点における127.0.0.1 (トーク)による版 (ページの作成:「 ==localconnection== *送信 import flash.net.LocalConnection; import flash.events.StatusEvent; connect:LocalConnection = new LocalConnection(); connect.send("myConn...」)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

localconnection

*送信
import flash.net.LocalConnection;
import flash.events.StatusEvent;
connect:LocalConnection = new LocalConnection();
connect.send("myConnect", "method1", "str1");
connect.addEventListener(StatusEvent.STATUS, onStatus);
private function onStatus(event:StatusEvent):void {
  switch (event.level) {
   case "status":
       trace("LocalConnection.send() succeeded");
       break;
   case "error":
       trace("LocalConnection.send() failed");
       break;
  }
}
*受信
import flash.net.LocalConnection;
import flash.text.TextField;
connect:LocalConnection = new LocalConnection();
connect.client = this;
connect.connect("myConnect");
public function method1(str:String):void{
  var txt:TextField = new TextField();
  txt.text = str;
  addChild(txt);
}