Skip to main content
August 16, 2011
Answered

Loading SWF's in AIR for iOS

  • August 16, 2011
  • 14 replies
  • 7972 views

Hi,

I am working on a project in AIR for iOS.  It's great that we as flash developers are now able to compile our actionscript code for iOS.

The project i'm working on is divided in different SWF-files.  There is one master SWF file that loads the others when needed.

Now i can't get loading of a swf file actually working.  The only thing i see is the background of the child being displayed, but then the program freezes and no actionscript code of the child gets exectuted.

The children swf's are loaded with a simple Loader:

var loader:Loader = new Loader();

childLayer.addChild(loader);

var url:URLRequest = new URLRequest("child.swf");

loader.load(url);

When i publish the master swf file i include the children swf files in the package.

Is it actually possible to use multiple swf's in your iOS projects?
And what are the limitations for this?

Thanks.

greeting,

Bert

This topic has been closed for replies.
Correct answer relaxatraja

Yes it is possible to include any number of swf within your main app, but your external swf should not contain action script code. Just you can have graphics, symbols, textfield etc on the timeline but with no timeline scripts.

14 replies

Inspiring
December 15, 2011

Is there a way to load the application Domain in iOS?  I have a graphic Library (swf) with linkage names and instance names.  Is this considered actionscript if it's not on the timeline? I only have labels on timelines and no actual code attached to my file

The only way i've managed to make it work is to place all instances on a timeline and replicate the structure with an xml on the side. Which sortof sucks.

Known Participant
January 29, 2013

I think This can be a good news for you !

Air3.6

Multiple SWF Support

This feature provides support for packaging and loading multiple SWFs on iOS in AOT mode. With this feature, user can use multiple

SWFs in an AIR iOS application using the Loader class.

http://labsdownload.adobe.com/pub/labs/flashruntimes/shared/air3-6_flashplayer11-6_releasenotes.pdf

Inspiring
August 17, 2011

Hi,

From a structural point of view you'd be best having the external SWFs without any code anyway.

We've built a presentation tool which has similar functionality to this and works really well. Esp since the designers don't need to know any code

Also, results in smaller external swf files overall and more portability.

MVC

Colin Holgate
Inspiring
August 16, 2011

The swfs you're loading can't have any code in them at all. If they do, then it will hang in the way you describe. If you made it be a debug build, you'll then see the error message that the app is trying to show you.

August 16, 2011

Thanks for the quick answers.

I now did run the program in debug mode (this video explains the debugging very well http://www.youtube.com/watch?v=DanNBN89uhs) and it's giving an error for running non-compiled actionscript.

So there is no way of compiling the actionscript of the children swfs and included that in the master package?

Colin Holgate
Inspiring
August 16, 2011

No, but there may be ways to achieve what you're trying to do. What's the overall goal?

relaxatraja
relaxatrajaCorrect answer
Inspiring
August 16, 2011

Yes it is possible to include any number of swf within your main app, but your external swf should not contain action script code. Just you can have graphics, symbols, textfield etc on the timeline but with no timeline scripts.

Participating Frequently
August 16, 2011

It is possible. Just make sure you include the files you want to load in the package when building it.

In Flash Builder, check under Project -> Properties -> ActionScript Build Packaging -> [desired platform] -> Package Contents