2 Replies Latest reply on Jul 20, 2011 2:08 AM by RichardSteer77

    Managing code and data across multiple SWFs

    RichardSteer77

      Hi all.

       

      This is our first large Flash project and on the whole things are going well, but we've come across an issue which we are getting conflicting advice on and can't quite see the best way to approach it. It seems like a fairly fundamental issue, so we are hoping there is a cleaner answer than the ones we have been looking at; so any links to good tutorials, examples or docs on this would be much appreciated! We've done a fair bit of web trawling already, but can't quite seem to find exactly what we are looking for.

       

      We are going to have a large amount of code and data in this project, so we want to keep things well organised from the start. We have a number of FLA files which link to appropriate AS files. We have a single root file and currently we import the assets from the other files into the root file (and also therefore use 'Update' when we change them) and compile it all into one big SWF. This works well enough for now, but is obviously not a good long term strategy, already we have problems with maintaining updates and the main SWF getting too large – we always knew this was a starting point, so now we are looking to change it to something better.

       

      We believe that what we should be doing, is to compartment all our bits of code and data into manageable chunks, compile them into SWCs and SWFs, and use runtime shared library functionality.

       

      So the root SWF is fairly small and acts as a loader for the other SWFs which load as needed. We might have an 'Menus.swf' which is entirely AS files containing menu super classes (with a token FLA to bind them together), and then a 'specificMenu.swf' which has data and code to handle that particular menu. 'specificMenu.swf' can link with 'menus.swc' to be able to use those classes, to allow us to publish 'specificMenu.swf' without dragging in all the AS classes for the whole project. The root SWF links them all together, and gets the ball rolling by organising the loading of the various SWFs.

       

      Our other possible approach is to have all the code compiled into one root SWF, and to have just plain art assets in the dynamic loadable SWFs. This is likely to be simpler, but it loses us the ability to tightly link the code and art assets which doesn't really feel like a good solution.

       

      This is a cobbled together approach from reading probably too many tutorials and articles on how to do this, some better than others, so I'm hoping someone can point out which bits are good, which are not, and ideally a single good tutorials to follow – thanks in advance for any help!