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.
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!
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.
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...
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.
Okay. I guess I'm not clear what you meant before when you wrote;
Dave Wolfe wrote:
Some files may get loaded at runtime even if you're using swcs (video, xml, etc)
I think I read this to mean I will not have complete control over which particular items get loaded beyond what is immediately instantiated or required by the main swf file in the ipa. Is it safe to assume unreferenced movieclips and graphic assets will be ignored at runtime load then?
Thanks for your help!
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.
Europe, Middle East and Africa