Skip to main content
Inspiring
January 17, 2013
Answered

How to load External swf file in AIR

  • January 17, 2013
  • 1 reply
  • 3971 views

I try this code its working in computer but when I publish this file in .apk or .ipa , my external swf file is not opening

(I include my external file as well)

places_btn.addEventListener(MouseEvent.MOUSE_DOWN, newvid);

function newvid(event:MouseEvent) {

     trace("you clicked me");

     var loadit = new Loader();

     addChild(loadit);

     loadit.load(new URLRequest("scene02.swf"));

}

This topic has been closed for replies.
Correct answer moccamaximum

add this in your newid function:

You forgot to put the beginning of your original function in it:

     var loadit = new Loader();

     addChild(loadit);

    var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

    loadit.load(new URLRequest("scene02.swf"), _lc);

1 reply

Inspiring
January 17, 2013

add this in your newid function:

var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

loadit.load(new URLRequest("scene02.swf"), _lc);

details about why you should provide a loader context here

User Unknow
Legend
January 19, 2013

If you try to load AIR App from CD - in some cases Air can't find file using Loader. Use File class instead and only than using Loader use loadBytes. I made presentation that works prefectly locally. But when I put it on CD - it's can't find any SWF so only one solution was it's use File class.

71081Author
Inspiring
January 19, 2013

then what well be the code??