我試圖從C#的Response.Write(「字串例如」)爲ActionScript字符串來讀取SWF文件閱讀C#的Response.Write與ActionScript 3.0中
我的ActionScript代碼看起來像這樣
var requestVars:URLVariables = new URLVariables();
requestVars.ornTest = "test";
var request:URLRequest = new URLRequest();
request.url = "http://localhost/apps/game/tree/DesignFlash.aspx";
request.method = URLRequestMethod.GET;
request.data = requestVars;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, loaderCompleteHandler);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
try
{
loader.load(request);
}
catch (error:Error)
{
trace("Unable to load URL");
}
private function loaderCompleteHandler(event:Event):void
{
var variables:URLVariables = new URLVariables(event.target.data);
if(variables.success)
{
var ornArray = deserializeString("read string from C# here");
for(var i:int=0;i<ornArray.length;i+=3)
{
addOrnamentProperty(ornArray[i],ornArray[i+1],ornArray[i+2]);
}
addOrnamentsFromArrayList();
}
}
private function httpStatusHandler (event:Event):void
{
//trace("httpStatusHandler:" + e);
}
private function securityErrorHandler (event:Event):void
{
trace("securityErrorHandler:" + event);
}
private function ioErrorHandler(event:Event):void
{
trace("ioErrorHandler: " + event);
}
... ...我的C#像這樣
protected void Page_Load(object sender, EventArgs e)
{
var test = Request["ornProperties"];
if (!String.IsNullOrEmpty(Request.Params["ornTest"]))
{
string paramVars = Request.Params["ornTest"];
Response.Write("this string");
}
}
我怎樣寫「此字符串」從C#成,說點我的SWF文件的ActionScript「讀C#字符串這裏」內loaderCompleteHandler?
感謝
這是我需要知道到底是什麼。 loader.data是關鍵。太感謝了 – 2009-09-02 17:35:14