Skip to main content
Inspiring
March 21, 2012
Answered

Best practice for universal iOS app? swf or swc?

  • March 21, 2012
  • 1 reply
  • 2267 views

Hi,

I'm trying to map out a framework for my assets which helps keep the memory load low at runtime for an iOS universal app and ran across the following article regarding swc files.

http://www.flashrealtime.com/compiling-big-air-swf-to-ios/

However, it's unclear as to how this method would be beneficial from a memory standpoint. Don't the files still get loaded at runtime?

Or should I be looking at swf files with the code stripped out and referenced from the main swf in the ipa? (sounds like more work!)

Please help educate a noob!

Thanks!

This topic has been closed for replies.
Correct answer Dave_Wolfe

Some files may get loaded at runtime even if you're using swcs (video, xml, etc) but content that is traditionally loaded as a swf will need to be compiled into your main swf.  This isn't because it's more memory efficient, it's just to get around Apple's restrictive TOS.  So rather than loading a module.swf into your app, you instantiate module.swf's document class the same way you would instantiate any other class, and instead of unloading it when you want to free up memory you need to null all references to that object (and any objects it created) so it can be garbage collected. 

1 reply

Dave_WolfeCorrect answer
Inspiring
March 21, 2012

Some files may get loaded at runtime even if you're using swcs (video, xml, etc) but content that is traditionally loaded as a swf will need to be compiled into your main swf.  This isn't because it's more memory efficient, it's just to get around Apple's restrictive TOS.  So rather than loading a module.swf into your app, you instantiate module.swf's document class the same way you would instantiate any other class, and instead of unloading it when you want to free up memory you need to null all references to that object (and any objects it created) so it can be garbage collected. 

gtrAuthor
Inspiring
March 22, 2012

Thanks for the reply, Dave!

What I'm trying to figure out is the best way to achieve a fast load time for a universal app and was hoping I'd be able to instantiate only the necessary swc files as needed along with their appropriately linked classes. (swc#1 for iPhone 3G bitmaps and MovieClips, swc#2 for iPhone4S, etc...) Seems this isn't possible now.

Anyone have some favorite they can share for fast app loads?

Thoughts on universal apps in general? I'm thinking maybe this isn't a good path anymore considering the beefy high-res screen on the new iPad...

Inspiring
March 22, 2012

It's still possible if you only instatiate the classes when you need them.  Just because they're compiled into the main swf doesn't mean they get instantiated right away.  It does add some overhead, but this is something every app has to deal with whether it's made in Flash or not.