Reputation: 49
In main.swf I loaded file.swf as:
var loader:Loader = new Loader();
var request:URLRequest = new URLRequest(“file.swf”);
When main swf loaded in HTML with an absolute link like:
"http://domain.com/main.swf"
It reports 404 error loading failed of file.swf
Because it looks for file.swf at current web host.
What's the best way to do this without hard code absolute url in main.swf? Is this something swfobject can help?
Upvotes: 0
Views: 413
Reputation: 9572
"What's the best way to do this without hard code absolute url in main.swf?"
You could provide the main url thru flashvars or by making a PHP request
Is this something swfobject can help?
Yes if you use flashvars
var params = {/* whatever you need here*/} swfobject.embedSWF("main.swf", "flash", "100%", "100%", "9.0.0" , "expressInstall.swf" , {mainUrl:"http://example.com/"}, params );
In AS3
//In your main class var mainURL:String = this.loaderInfo.parameters.mainUrl; var loader:Loader = new Loader(); var url:String = mainURL + “file.swf”; var request:URLRequest = new URLRequest(url);
Upvotes: 1