Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

flash AIR app cannot load child swfs on publish to device

Guest
Aug 19, 2013 Aug 19, 2013

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

TOPICS
ActionScript
4.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 20, 2013 Aug 20, 2013

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.

*********************************************************

...
Translate
Community Expert ,
Aug 19, 2013 Aug 19, 2013

your external swfs need to be added to the included files field in your publish for mobile settings panel.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 19, 2013 Aug 19, 2013

Oh, that's of course already the case! Any other suggestions?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013

your target may not support proloader.  try using the loader class.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 19, 2013 Aug 19, 2013

Ok, is it as easy as replacing the 'ProLoader' part with 'Loader'? Or is there more code involved?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013

Ok, is it as easy as replacing the 'ProLoader' part with 'Loader'?

yes

Or is there more code involved?

no

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 19, 2013 Aug 19, 2013

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;

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013

import flash.display.Loader;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 19, 2013 Aug 19, 2013

ah, unfortunately those assets are still not loading on device with the Loader/ProLoader change!!

Do you have any other ideas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2013 Aug 19, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 20, 2013 Aug 20, 2013

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 20, 2013 Aug 20, 2013

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??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2013 Aug 20, 2013

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);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 20, 2013 Aug 20, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2013 Aug 20, 2013

attach a screenshot of your included files field in your mobile publish settings.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 20, 2013 Aug 20, 2013

screenshot here

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2013 Aug 20, 2013

nothing was attached. 

http://forums.adobe.com/thread/963429

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 20, 2013 Aug 20, 2013

odd - and now?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2013 Aug 20, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 20, 2013 Aug 20, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2013 Aug 20, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 20, 2013 Aug 20, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 21, 2013 Aug 21, 2013

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 21, 2013 Aug 21, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 21, 2013 Aug 21, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines