forked from: Getting image withouth crossdomain trough proxy
forked from Getting image withouth crossdomain trough proxy (diff: 1)
ActionScript3 source code
/**
* Copyright xzardaz ( http://wonderfl.net/user/xzardaz )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/rSPq
*/
// forked from wonderwhyer's Getting image withouth crossdomain trough proxy
// forked from wh0's Using proxies without crossdomain.xml
package {
import flash.display.LoaderInfo;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.system.Security;
import flash.text.TextField;
public class FlashTest extends Sprite {
// Wrap url in proxy parameter.
private function proxy(url:String):String {
return 'http://www.gmodules.com/ig/proxy?url=' + encodeURIComponent(url);
}
public function FlashTest() {
// Only the top level movie starts off with stage populated.
if (stage) {
// The top level movie is likely included from wonderfl.net and therefore unproxied.
// All we do in this case is load the proxied version.
// Allow the proxy domain so wee can access stage on lines 45-46.
Security.allowDomain('www.gmodules.com');
var l:Loader = new Loader();
l.load(new URLRequest(proxy(loaderInfo.url)));
addChild(l);
return;
} else {
// Allow Wonderfl to take a screen cap.
Security.allowDomain('swf.wonderfl.net');
addEventListener(Event.ADDED_TO_STAGE, init);
}
}
private function init(e:Event):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(new URLRequest(proxy("http://i1-news.softpedia-static.com/images/news2/Adobe-Droping-PPC-in-Next-Creative-Suite-CS-Release-2.png")));
}
private function complete(e:Event):void {
addChild((e.currentTarget as LoaderInfo).content);
}
}
}
