0
votes

Is there any way to pull down the source code for a page using actionscript 3?

For example, it goes to google.com and downloads the source code for it, then stores it in an array or string. Would URLdownloader work?

How could one do this?

1

1 Answers

1
votes

you can do this with a URLRequest

function getContent():void 
    {
        var request:URLRequest = new URLRequest('http://example.com');
        var loader:URLLoader = new URLLoader();
        loader.addEventListener(Event.COMPLETE, contentLoaded);
        loader.load(request);           
    }
function contentLoaded(e:Event):void 
    {
        //html stored in target.data
        trace(e.currentTarget.data);
    }