I have a preloader that is being served from a CDN, and I want it to load the target SWF also from the CDN but when it uses loaderInfo, it returns the hostname of the html file… Here’s the setup:
- index.html (hosted on primary domain) uses SWFObject to embed preloader
- preloader.as hosted on remote CDN, contains code below
- target.swf is to be loaded
I have inherited this code from another developer that I can’t contact and I’m not an AS coder…
var url:String = "target.swf";
....
var request:URLRequest = new URLRequest(url);
loader = new Loader();
loader.load(request);
This is what I’ve tried, but I think it’s returning the url of the index.html, not the CDN-hosted preloader:
var currentUrl:String = stage.loaderInfo.url;
var url:String = currentUrl.substring(0,currentUrl.length-13) + "target.swf";
....
Is there some way that I can get the URL that the preloader was served from which is the CDN?
Thanks,
Jonathan
stage.loaderInfo.urlreturns indeed the URL of the page displaying the swf. You may give your swf the address of the CDN as a parameter:HTML
Then to retrieve this parameter, use:
AS3