Skip navigation
Currently Being Moderated

Best practice for universal iOS app? swf or swc?

Mar 21, 2012 7:31 AM

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!

 
Replies
  • Currently Being Moderated
    Mar 21, 2012 2:10 PM   in reply to gtr

    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. 

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2012 5:45 PM   in reply to gtr

    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. 

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2012 6:53 PM   in reply to gtr

    They don't gobble up memory at random, they gobble up memory when you instantiate them, just like any other class.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 22, 2012 2:13 PM   in reply to gtr

    What I meant by that is that if you can externalize your assets to prevent them from being compiled into the swc, then you can keep the main swf smaller and avoid some overhead.  Things like xml, images, audio, and video are easy to keep as external assets.  If you compile them into the main swf and don't ever use them then they won't automatically get instantiated and eat memory, but there is still going to be some additional overhead just because they are there.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points