---
title: "flash remoting 的使用"
author: "Fis"
date: "2009-10-24T12:47:11Z"
tags: []
slug: "flash-remoting"
draft: false
lastmod: "2009-10-24T13:27:48Z"
id: 503232
url: "https://fis.iteye.com/blog/503232"
---

实例代码 
import flash.net.Responder; 
import flash.net.NetConnection; 
var mynet:NetConnection = new NetConnection(); 
mynet.connect("http://192.168.1.125/amfphp/gateway.php"); 
mynet.call("testamf.wakao",new Responder(onOk, onNotOk)); 
function onOk(e:String) { 
myText.text = "输出数据:"+e; 
} 
function onNotOk() { 
myText.text = "failer"; 
} 
解释: 
导入类flash.net.Responder和类flash.net.NetConnection 
新建一个NetConnection实例myNet 
调用myNet连接网关的方法myNet.connect() 
调用myNet的call方法,发出请求并定义响应方法myNet.call(,,) 
定义响应方法onOk(),onNotOk()