Hi,
I am trying to read in a string from a C# Response.Write("string example") into ActionScript for a swf file
My actionscript code looks like this
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);
}
...And My C# looks like this
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");
}
}
How do I write "this string" from the C# into the ActionScript of my SWF file at the point that says "read C# string here" within the loaderCompleteHandler?
Thanks