lundi 6 février 2017

How to separate URL response data in ActionScripts3

I'm working on a site that response to GET request in simple text format, I want to save just data not title in variables.

Code:

 function URLRequest_method():void 
 { 
       var url:String = "http://ift.tt/2lgBXwL"; 

       var getbalance:String      = "mode=api&apikey=*=getbalance"; 

       var postParams:URLVariables = new URLVariables(getbalance);

       var request:URLRequest = new URLRequest(url);
        request.method = URLRequestMethod.GET;
        request.data = postParams;

       var urlLoader:URLLoader = new URLLoader();

        urlLoader.addEventListener(Event.COMPLETE, onLoaderComplete);
        urlLoader.load(request);

}

function onLoaderComplete( event:Event ):void
{
    var urlLoader2:URLLoader = event.target as URLLoader;

    txt_BALANCE1.text = urlLoader2.data; 

    trace( urlLoader2.data);

       //var json:Object = JSON.parse( urlLoader2.data );
       // trace( "json.response = ", json.response );

}

URLRequest_method();

Output: BALANCE:123.00

I need to save just: 123

Aucun commentaire:

Enregistrer un commentaire