To what Lapo says I want just to add that in apps that rely on asynchronous messages you may have some synch issues. Solving this issues can be hard if your application is with multiple frames.
(off topic: in the list of the words that may be included in the reserved words in the future versions of AS in synchronize - so who know may be well have synchronize in Flash at last)
Also by my opinion frames are only for animations - they must not be used for performing actions such as displaying dialog boxes, panels and other thing of this kind. Especially with the new Display architecture introduced in Flash CS3. There is nothing so bad to use the frames in such manner but the code will be hard to maintain - searching AS code in multiple frames make the code less readable and less extensive.
Code: Select all
the reason I dont want to use a multiple "swf" file solution is because I think it may not be good for users to have to download several files over the Internet as the game calls for them.... it may be better to just wait at the start of the game for one big file and then start playing without interruptions.
Basically minimizing the number of files is good practice (more about how to increase your site performance you can read here -
http://developer.yahoo.com/performance/rules.html#num_http). But in this case we talk about swf files - they are a bit larger than javascript and css - even the image files - so the time for the initiating HTTP session it's not such a big percentage. Also five is not so big number.
Also I want to say few things. After Flash downloads the movie clip it caches it so next time you try to download it just takes it from the cache.
Next you can load the external swf only once - you don't have to download them every time you call them.
Now - for the user is all the same if you load 1 or 100 swf files. For him/her just meters the speed with which it downloads the app.
Here is some tricks:
* Let's suppose you app consist of lobby and game. So you can do this - just load the lobby(instead the lobby + game) and then display it. So we reduce the time from the moment user click on the link that opens the flash and the moment he/she can interact with it. Now you can do two things:
1. Load the game in the background - while the user is in the lobby you can load the whole(or at least part of the game). If it tries to play before the game is loaded you can display the loading progress bar. This way we reduce the overall time user waits the app to download.
2. Load the game after the user begins new game - this way we split the wait time in two.
Of course 1. can be implemented even in single swf but only if it's with multiple frames - for example you can wait to load the frame with the lobby not for the entire movie. The flash player will download the rest of the swf in background - you need just to add load progress code before the game frame. If it's loaded ok - go ahead - if it's not just show the progress bar and wait
.
Of course this is simple example - external swf have other advantages. Lapo promise to post an article about that how to increase the app security loading external swf (actually this will increase the download time too because the swf are not cached and the user must download them again next time he/she visit the site). But it shows that it's possible using multiple swf to reduce the time the user waits the app to download.
I hope I've been useful and this post help you to orient in the jungle of the swf
.