views:

29

answers:

1

in AS3 I'm trying to load a URL (a Yahoo address) into the application so I can process the source code and pull things out of it.

However, when I load it, or any other page, I get 0 bytes back.

Here's my current code.

    private function doSearch():void {
                    var req:URLRequest = new URLRequest("http://yahoo.com");
                    var loader:URLLoader = new URLLoader();
                    loader.load(req);
                    loader.addEventListener(Event.COMPLETE, completeHandler);
                } 
private function completeHandler(event:Event):void {
                var loader:URLLoader = URLLoader(event.target);
                Alert.show(String(loader.bytesTotal),"HTML", Alert.OK);

            }

When this runs, all I receive is a 0 in the alert box, showing me that 0 bytes have been loaded.

+1  A: 

Yahoo.com only allows SWF/FlashPlayer access from sub-domains of yahoo.com.

See here http://www.yahoo.com/crossdomain.xml

<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt; 
<cross-domain-policy> 
  <allow-access-from domain="*.yahoo.com" secure="false" /> 
</cross-domain-policy>
slomojo