Copy link to clipboard
Copied
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_desmatosuchus.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_02_3,false,0,true);
import fl.display.ProLoader;
import flash.events.Event;
var fl_ProLoader_02:ProLoader;
var fl_ToLoad_02:Boolean = true;
function fl_ClickToLoadUnloadSWF_02_3(event:MouseEvent):void
{
if(fl_ToLoad_02)
{
fl_ProLoader_02 = new ProLoader();
fl_ProLoader_02.load(new URLRequest("dinofilms/triassic_desmatosuchus.swf"));
fl_ProLoader_02.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete_02)
addChild(fl_ProLoader_02);
fl_ProLoader_02.x = 0;
fl_ProLoader_02.y = 144;
}
else
{
if (fl_ProLoader_02!=null) {
removeChild(fl_ProLoader_02);
fl_ProLoader_02.unloadAndStop();
fl_ProLoader_02 = null;
}
}
fl_ToLoad_02 = !fl_ToLoad_02;
}
function onComplete_02(e:Event):void {
e.currentTarget.content.addEventListener(Event.ENTER_FRAME,OEF_02);
}
function OEF_02(e:Event):void {
if (e.currentTarget.currentFrame==e.currentTarget.totalFrames) {
e.currentTarget.stop();
e.currentTarget.removeEventListener(Event.ENTER_FRAME,OEF_02);
removeChild(fl_ProLoader_02);
fl_ProLoader_02.unloadAndStop();
fl_ProLoader_02 = 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.
I would really appreciate the assistance, I am a reluctant coder!
Message was edited by: Fiona Passantino
yes, that's important when you load swfs that contain actionscript and you need that loaded actionscript to work and is something i alluded to in message 9.
it's not relevant to your problem unless you've mis-explained the problem. from your description, you're not seeing the loaded swfs load. if the swfs actually load without problem, but they contain actionscript that does not work, you need to correct the description of your problem.
*********************************************************
...Copy link to clipboard
Copied
your external swfs need to be added to the included files field in your publish for mobile settings panel.
Copy link to clipboard
Copied
Oh, that's of course already the case! Any other suggestions?
Copy link to clipboard
Copied
your target may not support proloader. try using the loader class.
Copy link to clipboard
Copied
Ok, is it as easy as replacing the 'ProLoader' part with 'Loader'? Or is there more code involved?
Copy link to clipboard
Copied
Ok, is it as easy as replacing the 'ProLoader' part with 'Loader'?
yes
Or is there more code involved?
no
Copy link to clipboard
Copied
OK, I replaced all the "ProLoader" instances with "Loader" and I am getting an error, below (see***)
//start button
start_button_TRI_coelophysis.addEventListener(MouseEvent.CLICK,
fl_ClickToLoadUnloadSWF_01_3,false,0,true);
import fl.display.Loader; **HERE, ERROR IS: 1172 fl.display:Loader could not be found**
import flash.events.Event;
var fl_Loader_01:Loader;
//This variable keeps track of whether you want to load or unload the SWF
var fl_ToLoad_01:Boolean = true;
function fl_ClickToLoadUnloadSWF_01_3(event:MouseEvent):void
{
if(fl_ToLoad_01)
{
fl_Loader_01 = new Loader();
fl_Loader_01.load(new URLRequest("dinofilms/triassic_coelophysis.swf"));
fl_Loader_01.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete_01)
addChild(fl_Loader_01);
fl_Loader_01.x = 0;
fl_Loader_01.y = 144;
}
else
{
if(fl_Loader_01!=null) {
removeChild(fl_Loader_01);
fl_Loader_01.unloadAndStop();
fl_Loader_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_Loader_01);
fl_Loader_01.unloadAndStop();
fl_Loader_01 = null;
}
}
Copy link to clipboard
Copied
import flash.display.Loader;
Copy link to clipboard
Copied
ah, unfortunately those assets are still not loading on device with the Loader/ProLoader change!!
Do you have any other ideas?
Copy link to clipboard
Copied
no, i've never had a problem loading assets though there used to be a problem with loaded swfs having actionscript that would not execute when loaded into iDevices.
Copy link to clipboard
Copied
I just don't know what to do anymore... those swfs are just not loading on device, but work fine on test export. I deleted all the swfs from the included files lineup and re-pointed them all, still nothing. Is there a limit to how many swfs can be pointed-to? Is there perhaps anyone there who knows what to do here?
Copy link to clipboard
Copied
I found this on the AIR forum, does it mean something to you?
"*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."
From here: http://blogs.adobe.com/airodynamics/2012/11/09/packaging-and-loading-multiple-swfs-in-air-apps-on-ios/
I of course have no idea what this means, but maybe someone out there does??
Copy link to clipboard
Copied
yes, that's important when you load swfs that contain actionscript and you need that loaded actionscript to work and is something i alluded to in message 9.
it's not relevant to your problem unless you've mis-explained the problem. from your description, you're not seeing the loaded swfs load. if the swfs actually load without problem, but they contain actionscript that does not work, you need to correct the description of your problem.
***************************************************************************************************
edit: the above is not correct. you do need to declare a loadercontext when loading an external swf with the newer (3.6+) air sdk's even if the external swfs contain no actionscript. otherwise, the load() method (and any code appearing thereafter) fails to execute
so, use something like:
loader = new Loader();
var lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
loader.load(new URLRequest("dinofilms/cretaceous_ankylosaurus.swf"),lc);
Copy link to clipboard
Copied
no no, there is no action script on the child swfs - they are just plain films. All the as code is on the parent timeline.
Copy link to clipboard
Copied
attach a screenshot of your included files field in your mobile publish settings.
Copy link to clipboard
Copied
screenshot here
Copy link to clipboard
Copied
nothing was attached.
Copy link to clipboard
Copied
odd - and now?
Copy link to clipboard
Copied
nada.
check that link in message 16 for info on how to attach a screenshot.
after posting your message, look at it to see if the image is embedded. if not, edit it and try again.
Copy link to clipboard
Copied
hmm - that attachment process is obviously not working, so here's a link.
http://www.distanttrain.com/issues.png
thanks for staying with me on this - it's driving me nuts!!
I have other apps build with this very same code in AIR 3.4 that work fine. It's something having to do with the upgrade to AIR 3.8, I am sure of this.
Copy link to clipboard
Copied
one long shot: publish your ipa file to the same directory that contains your swf.
if that doesn't work, someone will need to download your files and test them.
Copy link to clipboard
Copied
Yes, it is already all in the same directory. i even tried putting all the child files on the top level. But the same result!
Can I send you a zip file of the source material? I think at this point that's all I can think to do.
Copy link to clipboard
Copied
from the png that you posted, your ipa is nested several directories down. it's not in the same directory. try changing that.
another thing, instead of adding each of those swfs, add the dinofilms directory that contains those swfs.
also, i see there's another person actively posting with a similar issue and also using a mac. this may be a mac issue. do you have a pc you can use?
Copy link to clipboard
Copied
What do you mean "nested several directories down"? The IPA is published right next to the swf, on the same level, right next to all the certificates and the folder with the assets. Or, do you mean all this has to be published onto the highest possible level on the computer? on the desktop? Perhaps you can be a bit more detailed.
I will also try the folder option, thanks. And thanks again for sticking with this.
Copy link to clipboard
Copied
check to see if you're using an old ipa next to your swf.
it's possible you're publishing your ipa to an absolute path that's in the same directory as your swf but you should double check that by looking at the output file shown in your png.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now