Reputation: 1866
if I understand correctly - the main difference between Flash and Flex on the client's side is that Flex requires loading additional files for Flex to work.
Is this the case, and if so, how much added data does Flex load up compared to Flash applications?
Thanks!
Upvotes: 1
Views: 468
Reputation: 17734
Flex 3 introduced the "framework RSL" feature which allows the Flex framework to be loaded separately from the main application SWF. This brings about a significant reduction in overall Flex application size:
http://ted.onflash.org/2007/06/flex-3-thursday-dramatically-smaller.php
The other benefit to the RSL architecture is that the signed Flex framework RSLs (.SWZ files) are stored in a special private cache of the Flash Player. This means that the first time you run a Flex app using a given version of the framework, Flash Player will download the SWZ file from the Adobe CDN and store it in the cache. The next time you load any Flex application using the same version of the framework, the FP will simply load what is already in the local cache.
As of version 4.x, the default behavior for the MXML compiler is to generate apps that use the framework RSLs. More information is available here:
http://livedocs.adobe.com/flex/3/html/help.html?content=rsl_09.html
All that being said, Flex applications are likely to be at least somewhat larger than their Flash "equivalents." If you use the "-keep" option on the compiler you can see the ActionScript code that the MXMLC compiler generates and it's pretty heavyweight.
Upvotes: 0
Reputation: 2604
Flex is actually compiling as result biger files than Flash, because of the Frameworks which adds.
About the difference - it will be different, depending what actually library you have been used inside your project.
Anyway - i think quality of flex framework shall be considered over the file size. The difference usually is about 2x biger file sizes for a serious projects ( and what of this when we are speaking about file sizes usually not above a few kb. ), but i would exchange the bigger size for much greather quality and programming time spend even for a simple tasks.
About loading additional files. There is 3 methods which is presented by Flash Builder ( Flex ) which u can use. For instance if you choose "Framework Linkage" to be "Merged into code" - there wont be any external libraries loaded, everything shall be embed inside your result file. If you choose "Framework Linkage" to be "Runtime Shared Libraries (RSL)" then there will be libraries loading from your server. Anyway - considering this methood will result really small file size, and you will load only once the libraries from external source, the next time when you are loading your file - there wont be any external libraries loading ( if there is not any change with your framework i mean ).
Upvotes: 2
Reputation:
Flash movies created by the Flex compiler don't load any "additional files" to be loaded by some Flash Player.
Even though the question in its original form is asking about loading files on the client side, I guess we can expand on what Flex is vs. Flash. Flex applications are just that, applications, so yes the smallest Flex swf is always bigger than the smallest Flash swf. They are not the same, and so there is little value in comparing them other than to observe how they are two different things.
Upvotes: 0
Reputation: 48167
The overhead that Flex brings in is significant. You can do this experiment: Create an empty project in Flash Builder and then Flash CS5 and compile it.
The Flex project is 1024 KBytes. The app itself comes in at 41 KB and the rest is mostly in the Flex framework, the Spark framework, and the text layout libraries. (Results are certainly different based on the libs you bring in)
The Flash project is 4 KBytes.
BUT, that is no reason to avoid Flex. Remember that these libraries (SWCs) are cached. You only need to load them once per project.
Also, more importantly, Flex projects are not intended to be websites. They are not little flash movies embedded in your website. They are full-blown applications. They tend to be Line-of-Business applications that work heavily with data. As an application framework, I don't object to the 1 MB size overhead. I can't do what I do in Flex very easily or efficiently in Flash. From that perspective, Flash and Flex are different tools used for different jobs.
In other words, for the clients in which I employ Flex, they have never complained about the size of the download. It simply isn't what they care about in the environment/needs of the application solution. Had I chosen Flex for the wrong purpose, however, I would expect that the story would be different.
Upvotes: 1