As3 模拟As2.0LoadVars 传参

代码
var  myRequest:URLRequest  =   new  URLRequest( " http://www.webstudio.com.cn/msg.php " );
var  myLoader:URLLoader  =   new  URLLoader();
var  myVariables:URLVariables  =   new  URLVariables();

myLoader.addEventListener(Event.COMPLETE, loadSuccessful);
myLoader.addEventListener(IOErrorEvent.IO_ERROR, loadError);

myVariables.var1 
=   " hello " ;
myVariables.var2 
=   " hi " ;

myRequest.method 
=  URLRequestMethod.POST;
myRequest.data 
=  myVariables;

myLoader.load(myRequest);

function  loadSuccessful($evt:Event): void
{
    trace(
" 参数已发送 " );
}

function  loadError($evt:IOErrorEvent): void
{
    trace(
" 发送失败. " );
}

你可能感兴趣的:(load)