2011-01-31 66 views
2

我想在Flash中提交一個表單並將用戶發送到另一個html/php頁面並獲取該頁面上的發佈信息。我怎樣才能做到這一點?用AS 3.0發送帖子

回答

4
// create a URLRequest object with the target URL: 
var url : String = 'newpage.html'; 
var urlRequest : URLRequest = new URLRequest(url); 

// create a URLVariables object and add all the values you want to send with their identifiers: 
var urlVariables : URLVariables = new URLVariables(); 
urlVariables['formfieldId'] = 'formfieldValue'; 

// add the urlVariables to the urlRequest 
urlRequest.data = urlVariables; 

// set the method to post (default is GET) 
urlRequest.method = URLRequestMethod.POST; 

// use navigateToURL to send the urlRequest, use '_self' to open in the same window 
navigateToURL(urlRequest, '_self');