Link to home
Start Free TrialLog in
Avatar of TheMagellanClouds
TheMagellanClouds

asked on

Converting the return values of URL Loader into an array in Actionscript 3

I am taking values from an Access database into an ASP file and from there into Flash.
I am getting the data ok, but however I am having problembs converting that data from the loader object into an Array.

These are the values I am getting in Flash from ASP. What is the best way to convert this into an array?

completeHandler: 1/2/2007,56.036,56.2,55.94;01/3/2007,56.023,56.197,55.94;01/1/2008,18.847,0,0;02/1/2008,18.86,0,0;03/1/2008,18.845,0,0;04/1/2008,18.842,0,0;05/1/2008,18.848,0,0;06/1/2008,18.856,0,0;07/1/2008,18.855,0,0;08/1/2008,18.855,0,0;0

 If anyone can helpe me out, it will be greatly appreciated.
Best,
TMC

ASP CODE Snippet:
Do While not rsLakes.EOF

      Response.Write (rsLakes("SDate"))
      Response.Write (",")      
      Response.Write (rsLakes("DailyL"))
      Response.Write (",")      
      Response.Write (rsLakes("High"))
      Response.Write (",")      
      Response.Write (rsLakes("Low"))
      Response.Write (";")      
      Response.Write (rsLakes("Curve"))
      Response.Write (" ; ")      

      'Move to the next record in the recordset
      rsLakes.MoveNext

Loop



function lakes(){
	
	var loader:URLLoader = new URLLoader();
var nrequest:URLRequest = new URLRequest("lakes.asp");
 
var variables:URLVariables = new URLVariables();
variables.LNumber = glo.bal.lakeNumber;
nrequest.data = variables;
nrequest.method = "POST"; // !! this is the default 
loader.load(nrequest);
configureListeners(loader);
	trace(nrequest.data);
 
}
  
 
 
 
        function configureListeners(dispatcher:IEventDispatcher):void {
            dispatcher.addEventListener(Event.COMPLETE, completeHandler);
            dispatcher.addEventListener(Event.OPEN, openHandler);
            dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
            dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
            dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
        }
 
		function completeHandler(event:Event):void {
            var loader:URLLoader = URLLoader(event.target);
 trace("completeHandler: " + loader.data);}
			           
 
        function openHandler(event:Event):void {
            trace("openHandler: " + event);
        }
 
       function progressHandler(event:ProgressEvent):void {
            trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
        }
 
        function securityErrorHandler(event:SecurityErrorEvent):void {
            trace("securityErrorHandler: " + event);
        }
 
        function httpStatusHandler(event:HTTPStatusEvent):void {
            trace("httpStatusHandler: " + event);
        }
 
        function ioErrorHandler(event:IOErrorEvent):void {
            trace("ioErrorHandler: " + event);
        }
 
 
lakes();

Open in new window

Avatar of julianopolito
julianopolito
Flag of Brazil image

i'll send you an example in a minute
ASKER CERTIFIED SOLUTION
Avatar of julianopolito
julianopolito
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TheMagellanClouds
TheMagellanClouds

ASKER

Thanks a lot man that worked like a charm!