Skip to main content
Known Participant
February 1, 2012
Question

External swf won't load after publish AIR for iOS.

  • February 1, 2012
  • 1 reply
  • 1467 views

Good day guys,

Just got my first AS3 application AIR for iOS application running on my pc.

Files are running locally & all files is under the same folder.

But the problem arises when it is tested & played on the ipad. The external swf files did'nt load on the main swf.

What could be the problem regarding this issue?

Here's my code:

import flash.events.Event;

import flash.events.MouseEvent;

import flash.display.MovieClip;

import flash.net.URLRequest;

import flash.display.Loader;

// Default swf & target to stage movieclip

var Xpos:Number = 247.45;

var Ypos:Number = 251.45;

var swfMC:MovieClip = new MovieClip();

addChild(swfMC);

var loader:Loader = new Loader();

var newSWFRequest:URLRequest = new URLRequest();

var defaultSWF:URLRequest = new URLRequest("swf1.swf");

loader.load(defaultSWF);

loader.x = Xpos;

loader.y = Ypos;

swfMC.addChild(loader);

swf4Frame.visible = false;

swf3Frame.visible = false;

swf2Frame.visible = false;

swf1MC.gotoAndStop("swf1");

swf4MC.gotoAndStop("default");

swf2MC.gotoAndStop("default");

swf3MC.gotoAndStop("default");

// Functions

function loadSWF(swfname: String): void{

 

          if (swfname == "swf1"){

                    swf4Frame.visible = false;

                    swf2Frame.visible = false;

                    swf3Frame.visible = false;

                    swf1Frame.visible = true;

                    headerBg.gotoAndStop(swfname);

                    swf1MC.gotoAndStop(swfname);

                    swf4MC.gotoAndStop("default");

                    swf2MC.gotoAndStop("default");

                    swf3MC.gotoAndStop("default");

                    newSWFRequest.url = swfname + ".swf";

                    loader.load(newSWFRequest);

                    loader.x = 247.45;

                    loader.y = 251.45;

 

          }else if (swfname == "swf2"){

                    swf1Frame.visible = false;

                    swf3Frame.visible = false;

                    swf4Frame.visible = false;

                    swf2Frame.visible = true;

                    headerBg.gotoAndStop(swfname);

                    swf2MC.gotoAndStop(swfname);

                    swf1MC.gotoAndStop("default");

                    swf3MC.gotoAndStop("default");

                    swf4MC.gotoAndStop("default");

                    newSWFRequest.url = swfname + ".swf";

                    loader.load(newSWFRequest);

                    loader.x = 62;

                    loader.y = 199.50;

 

          }else if (swfname == "swf3"){

                    swf4Frame.visible = false;

                    swf2Frame.visible = false;

                    swf1Frame.visible = false;

                    swf3Frame.visible = true;

                    headerBg.gotoAndStop(swfname);

                    swf3MC.gotoAndStop(swfname);

                    swf1MC.gotoAndStop("default");

                    swf2MC.gotoAndStop("default");

                    swf4MC.gotoAndStop("default");

                    newSWFRequest.url = swfname + ".swf";

                    loader.load(newSWFRequest);

                    loader.x = 132.50;

                    loader.y = 225.50;

 

          }else if (swfname == "swf4"){

                    swf1Frame.visible = false;

                    swf2Frame.visible = false;

                    swf3Frame.visible = false;

                    swf4Frame.visible = true;

                    headerBg.gotoAndStop(swfname);

                    swf4MC.gotoAndStop(swfname);

                    swf1MC.gotoAndStop("default");

                    swf2MC.gotoAndStop("default");

                    swf3MC.gotoAndStop("default");

                    newSWFRequest.url = swfname + ".swf";

                    loader.load(newSWFRequest);

                    loader.x = 62;

                    loader.y = 226.50;

          }

 

          //return loader;

}

// Btns Universal function

function btnClick(event: MouseEvent):void {

          trace(event.target.name + " clicked.");

          if(loader != null){

                    loader.unloadAndStop();

          }

          if (event.target.name == "swf1"){

                    loadSWF("swf1");

          }else if(event.target.name == "swf2"){

                    loadSWF("swf2");

          }

          else if(event.target.name == "swf3"){

                    loadSWF("swf3");

          }else if(event.target.name == "swf4"){

                    loadSWF("swf4");

          }

}

// Btn listeners

swf1.addEventListener(MouseEvent.CLICK, btnClick);

swf2.addEventListener(MouseEvent.CLICK, btnClick);

swf3.addEventListener(MouseEvent.CLICK, btnClick);

swf4.addEventListener(MouseEvent.CLICK, btnClick);

stop();

It runs fine on my local pc. But when it is publish AIR for iOS and played on ipad it did'nt work.

Any help is highly appreciated.

Thanks in advance.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 1, 2012

you must include all external files loaded dynamically in your iOS "included files"

Known Participant
February 2, 2012

Good day sir kglad,

I already did what you suggested but still did'nt work.

What I do is making a single fla file and all the external files content is pasted on the main timeline and do a scene by scene.

Thanks,

kglad
Community Expert
Community Expert
February 2, 2012

it doesn't make sense to add external file content to your fla timeline.  that's unneeded and adds unnecessary size to your published swf/air/ipa file.  it also doesn't help, in any way, with the loading of an external file and its content.

attach a screenshot of your air publish settings first (general) tab if you think you already did what i suggested.