0
votes

I have been struggling with this problem for WEEKS now and can't solve it. I have an flash AIR app (creative cloud, AIR 3.8) which is very simple: all it does is load external SWF movies on the click of a start button. It works FINE in test/PC but when I publish to device, the external swfs do not load.

HEre is the code on the main timeline that calls the external swfs:

 //start button

 start_button_TRI_coelophysis.addEventListener(MouseEvent.CLICK,     
 fl_ClickToLoadUnloadSWF_01_3,false,0,true);

 import fl.display.ProLoader;
 import flash.events.Event;

 var fl_ProLoader_01:ProLoader;
 var fl_ToLoad_01:Boolean = true;

function fl_ClickToLoadUnloadSWF_01_3(event:MouseEvent):void
{
if(fl_ToLoad_01)
{
    fl_ProLoader_01 = new ProLoader();
    fl_ProLoader_01.load(new URLRequest("dinofilms/triassic_coelophysis.swf"));

 fl_ProLoader_01.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete_01)
    addChild(fl_ProLoader_01);
    fl_ProLoader_01.x = 0;
    fl_ProLoader_01.y = 144;
}
else
{
    if(fl_ProLoader_01!=null) {
        removeChild(fl_ProLoader_01);
        fl_ProLoader_01.unloadAndStop();
        fl_ProLoader_01 = null;
    }
}
fl_ToLoad_01 = !fl_ToLoad_01;

}

function onComplete_01(e:Event):void {
e.currentTarget.content.addEventListener(Event.ENTER_FRAME,OEF_01);
}

function OEF_01(e:Event):void {
if(e.currentTarget.currentFrame==e.currentTarget.totalFrames) {
    e.currentTarget.stop();
    e.currentTarget.removeEventListener(Event.ENTER_FRAME,OEF_01);

    removeChild(fl_ProLoader_01);
    fl_ProLoader_01.unloadAndStop();
    fl_ProLoader_01 = null;
}
}

I am calling about 30 different movies on 30 different frames, so that's why I am using tags like "proLoader_01" so I don't duplicate them. All the external swfs are of course listed in the included files too.

1
Are you sure that those swfs are being packaged into your app?frankhermes
yes, definitely - and I just deleted them all and added them all again. Is there something amiss with the "start" button code? Or, is there a limit to how many external files you can point to?Fiona Passantino
I found this on the AIR support page: blogs.adobe.com/airodynamics/2012/11/09/… "For locally packaged secondary SWFs: Local secondary SWF w/o ABC Works (minor change required). The minor change is that when loading the SWF, the application domain should be the same as that of the main SWF i.e. ApplicationDomain.currentDomain." Does that mean anything to you? Does anyone understand this, can anyone help? I am using AIR 3.8. Thanks!!!!Fiona Passantino
yes, the swfs are definitely packaged in the app. Here is a screenshot of that panel: distanttrain.com/issues.pngFiona Passantino
Fiona, the AIR support page means you need to include an explicit LoaderContext. So your call to load should look like: yourLoader.load("someurl", new LoaderContext(false, ApplicationDomain.currentDomain, null));Jonathan Lidbeck

1 Answers

2
votes

You need to change

fl_ProLoader_01.load(new URLRequest("dinofilms/triassic_coelophysis.swf"));

to

fl_ProLoader_01.load(new URLRequest("dinofilms/triassic_coelophysis.swf"), new LoaderContext(false, ApplicationDomain.currentDomain));

Under iOS all your SWFs must be loaded inside the current application domain which is the ApplicationDomain.currentDomain.