Search code examples
flashvariablesashx

How to access the value from aspx page in flash?


Hai am trying to access the aspx variable.But i can't to do this.I dunno how to Solve my problem.anybody kindly help me.am using flash professional cs5.

import flash.net.URLRequest;
import flash.net.URLVariables;
import flash.net.URLRequestMethod;
import flash.events.Event;
var myRequest:URLRequest = new URLRequest();
var myVariables:URLVariables = new URLVariables();
var myLoader:URLLoader = new URLLoader();
myRequest.url = "http://xxxx";
myRequest.method = URLRequestMethod.POST;
myLoader.addEventListener(Event.COMPLETE, sendComplete);
myLoader.load(myRequest);
function sendComplete(e:Event):void{
trace(myLoader.load(myRequest));  
}

Solution

  • try this code,URLLoaderDataFormat.TEXT.this will retrieve the text.

    var myTextLoader:URLLoader = new URLLoader();
    myTextLoader.load(new URLRequest("http://www.smster.in/ipaddress/Handler.ashx"));
    myTextLoader.dataFormat=URLLoaderDataFormat.TEXT;
    
    myTextLoader.addEventListener(Event.COMPLETE, onLoaded);
    
    function onLoaded(e:Event):void {
    trace(e.target.data);
    }