Load External Swf From Link [As3]

I am trying to call a swf from a link in as3. I searched on internet and i used this code

var my_Loader:Loader = new Loader();
var my_url:URLRequest=new URLRequest("http://gurselgunacar.web44.net/flash/yalitimhesabi.swf");
my_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoading);
my_Loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
my_Loader.load(my_url);
function finishLoading(loadEvent:Event) {
addChild(loadEvent.currentTarget.content);
}
function errorHandler(errorEvent:Event):void {
trace("file missing");
}

as3 call link but i cant do anything in swf. In output flash give security error. And i tried crossdomain.xml thing and it didnt work :S

Upvotes: 0

Views: 1701

Answers (2)

Mateus Araújo
Mateus Araújo

Reputation: 61


Humm. Try to add these Security things:

Security.allowDomain("*");
Security.loadPolicyFile("http://gurselgunacar.web44.net/crossdomain.xml");

And use this in the URLRequest:

var my_url:URLRequest=new URLRequest("http://gurselgunacar.web44.net/flash/yalitimhesabi.swf?" + new Date().getTime()); //this will avoid caching old swf.

I tested on a EXE projector and it seems to work.

Upvotes: 0

Mateus Araújo
Mateus Araújo

Reputation: 61

The file http://gurselgunacar.web44.net/crossdomain.xml does not exists. You should create one.
The Loader will always look for a crossdomain.xml file at the target server.

Upvotes: 2

Related Questions