2010-04-22 82 views
2

我有一個asp.net頁面,我從誰登錄到user_id。現在我需要將這個user_id傳遞給在asp.net頁面中運行的flex應用程序,一個.swf。 如何在我的Flex應用程序中的變量中獲取此user_id。 或者什麼是獲得user_id到flex的最佳方式。 謝謝從asp.net頁面傳遞參數到flex應用程序

回答

1

你做了另一個asp.net頁面,在這個頁面上你得到了這個userid並寫在頁面上。來自flex應用程序的 用HTTPService命中該asp.net頁面並獲得該響應。 在響應u得到該用戶ID ...

var httpservice:HTTPService=new HTTPService(); 
    httpservice.url="http://xyz.com/getuser.aspx; 
    httpservice.useProxy=false; 
    httpservice.method="Post"; 
    httpservice.resultFormat="text"; 
    httpservice.addEventListener(FaultEvent.FAULT,GettingException); 
    httpservice.addEventListener(ResultEvent.RESULT,Result); 
    httpservice.send(); 


private function GettingException(e:FaultEvent){ 

Alert.show(e.fault.message, "Could not load page"); 

} 
private function Result(e:ResultEvent){ 

var Result:String = e.result.toString(); 
Alert.show(Result); 

} 
1

如果您鏈接到包含swf的ASP.Net頁面,你可以混淆USER_ID,並傳遞它的查詢字符串,或使用GUID是映射到user_id。 Flex可以從查詢字符串讀取值。請參閱this article.

或者,您可以將user_id值粘貼到flashvars(ASP.Net頁面應具有訪問權限)中並從此處讀取。

userID = Application.application.parameters.user_id; 
相關問題