Flash (AS3) can't read response ...
Posted
by Quandary
on Stack Overflow
See other posts from Stack Overflow
or by Quandary
Published on 2010-04-16T12:47:14Z
Indexed on
2010/04/16
13:23 UTC
Read the original article
Hit count: 447
Question: I call an asp.net handler (ashx) like this from Flash, and onLoadSuccessful, I get the ashx response back.
The problem now is whatever I do in onLoadSuccessful to get the responseStatus variable never gets me the variable (just an error message: property responseStatus for string not found), but the output of:
trace("Response: " + evt.target.data); is
Response: &responseStatus=ASP.NET+Fehler%3a+Die+Datei+%22C%3a%5cinetpub%5cwwwroot%5cRaumplaner_New%5cRaumplaner_New%5cabcdef.xml%22+konnte+nicht+gefunden+werden.&
It used to work in ActionScript2... Any hints as to what I do wrong ? I mean the request gets sent, and the reponse received, but no matter how I try to do it, I can't access the responseStatus variable...
var scriptRequest:URLRequest = new URLRequest(strURL);
var scriptLoader:URLLoader = new URLLoader();
var scriptVars:URLVariables = new URLVariables();
scriptLoader.addEventListener(Event.COMPLETE, onLoadSuccessful);
scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
scriptLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
scriptVars.ScaleString = nScale;
scriptVars.ModifyFile = "abcdef.xml";
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;
scriptLoader.load(scriptRequest);
function onLoadSuccessful(evt:Event):void
{
trace("Success.");
//ExternalInterface.call("alert", "Die neue Skalierung wurde erfolgreich gespeichert.");
//getURL("javascript:alert(\""+"Die neue Skalierung wurde erfolgreich gespeichert.\\nALLE Instanzen des Browsers schliessen und neu starten, damit die Ă„nderung in Kraft tritt."+"\");");
trace("Response: " + evt.target.data);
trace("ResponseStatus: " + evt.target.data.responseStatus);
var loader:URLLoader = URLLoader(evt.target);
trace("responseStatus: " + loader.data.responseStatus);
}
© Stack Overflow or respective owner